changeset 20804:a6eaedd8bd75

eliminate return statements after calls to print_usage * bitfcns.cc, cellfun.cc, debug.cc, dirfns.cc, strfns.cc: Eliminate return statements after calls to print_usage.
author John W. Eaton <jwe@octave.org>
date Fri, 04 Dec 2015 13:16:59 -0500
parents c22206c1a88f
children 2d6ddb2b157c
files libinterp/corefcn/bitfcns.cc libinterp/corefcn/cellfun.cc libinterp/corefcn/debug.cc libinterp/corefcn/dirfns.cc libinterp/corefcn/strfns.cc
diffstat 5 files changed, 642 insertions(+), 722 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/bitfcns.cc	Fri Dec 04 14:06:41 2015 -0500
+++ b/libinterp/corefcn/bitfcns.cc	Fri Dec 04 13:16:59 2015 -0500
@@ -156,209 +156,205 @@
 {
   octave_value retval;
 
-  int nargin = args.length ();
+  if (args.length () != 2)
+    print_usage ();
 
-  if (nargin == 2)
+  if (args(0).class_name () == octave_scalar::static_class_name ()
+      || args(0).class_name () == octave_float_scalar::static_class_name ()
+      || args(0).class_name () == octave_bool::static_class_name ()
+      || args(1).class_name () == octave_scalar::static_class_name ()
+      || args(1).class_name () == octave_float_scalar::static_class_name ()
+      || args(1).class_name () == octave_bool::static_class_name ())
     {
-      if (args(0).class_name () == octave_scalar::static_class_name ()
-          || args(0).class_name () == octave_float_scalar::static_class_name ()
-          || args(0).class_name () == octave_bool::static_class_name ()
-          || args(1).class_name () == octave_scalar::static_class_name ()
-          || args(1).class_name () == octave_float_scalar::static_class_name ()
-          || args(1).class_name () == octave_bool::static_class_name ())
-        {
-          bool arg0_is_int = bitop_arg_is_int (args(0));
-          bool arg1_is_int = bitop_arg_is_int (args(1));
+      bool arg0_is_int = bitop_arg_is_int (args(0));
+      bool arg1_is_int = bitop_arg_is_int (args(1));
 
-          bool arg0_is_bool = bitop_arg_is_bool (args(0));
-          bool arg1_is_bool = bitop_arg_is_bool (args(1));
-
-          bool arg0_is_float = bitop_arg_is_float (args(0));
-          bool arg1_is_float = bitop_arg_is_float (args(1));
+      bool arg0_is_bool = bitop_arg_is_bool (args(0));
+      bool arg1_is_bool = bitop_arg_is_bool (args(1));
 
-          if (! (arg0_is_int || arg1_is_int))
-            {
-              if (arg0_is_bool && arg1_is_bool)
-                {
-                  boolNDArray x (args(0).bool_array_value ());
-                  boolNDArray y (args(1).bool_array_value ());
+      bool arg0_is_float = bitop_arg_is_float (args(0));
+      bool arg1_is_float = bitop_arg_is_float (args(1));
 
-                  retval = bitopx (fname, x, y).bool_array_value ();
-                }
-              else if (arg0_is_float && arg1_is_float)
-                {
-                  uint64NDArray x (args(0).float_array_value ());
-                  uint64NDArray y (args(1).float_array_value ());
+      if (! (arg0_is_int || arg1_is_int))
+        {
+          if (arg0_is_bool && arg1_is_bool)
+            {
+              boolNDArray x (args(0).bool_array_value ());
+              boolNDArray y (args(1).bool_array_value ());
 
-                  retval = bitopx (fname, x, y).float_array_value ();
-                }
-              else if (! (arg0_is_float || arg1_is_float))
-                {
-                  uint64NDArray x (args(0).array_value ());
-                  uint64NDArray y (args(1).array_value ());
+              retval = bitopx (fname, x, y).bool_array_value ();
+            }
+          else if (arg0_is_float && arg1_is_float)
+            {
+              uint64NDArray x (args(0).float_array_value ());
+              uint64NDArray y (args(1).float_array_value ());
 
-                  retval = bitopx (fname, x, y).array_value ();
-                }
-              else
-                {
-                  int p = (arg0_is_float ? 1 : 0);
-                  int q = (arg0_is_float ? 0 : 1);
+              retval = bitopx (fname, x, y).float_array_value ();
+            }
+          else if (! (arg0_is_float || arg1_is_float))
+            {
+              uint64NDArray x (args(0).array_value ());
+              uint64NDArray y (args(1).array_value ());
 
-                  uint64NDArray x (args(p).array_value ());
-                  uint64NDArray y (args(q).float_array_value ());
-
-                  retval = bitopx (fname, x, y).float_array_value ();
-                }
+              retval = bitopx (fname, x, y).array_value ();
             }
           else
             {
-              int p = (arg0_is_int ? 1 : 0);
-              int q = (arg0_is_int ? 0 : 1);
-
-              NDArray dx = args(p).array_value ();
-
-              if (args(q).type_id () == octave_uint64_matrix::static_type_id ()
-                  || args(q).type_id () == octave_uint64_scalar::static_type_id ())
-                {
-                  uint64NDArray x (dx);
-                  uint64NDArray y = args(q).uint64_array_value ();
-
-                  retval = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_uint32_matrix::static_type_id ()
-                       || args(q).type_id () == octave_uint32_scalar::static_type_id ())
-                {
-                  uint32NDArray x (dx);
-                  uint32NDArray y = args(q).uint32_array_value ();
-
-                  retval = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_uint16_matrix::static_type_id ()
-                       || args(q).type_id () == octave_uint16_scalar::static_type_id ())
-                {
-                  uint16NDArray x (dx);
-                  uint16NDArray y = args(q).uint16_array_value ();
-
-                  retval = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_uint8_matrix::static_type_id ()
-                       || args(q).type_id () == octave_uint8_scalar::static_type_id ())
-                {
-                  uint8NDArray x (dx);
-                  uint8NDArray y = args(q).uint8_array_value ();
+              int p = (arg0_is_float ? 1 : 0);
+              int q = (arg0_is_float ? 0 : 1);
 
-                  retval = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_int64_matrix::static_type_id ()
-                       || args(q).type_id () == octave_int64_scalar::static_type_id ())
-                {
-                  int64NDArray x (dx);
-                  int64NDArray y = args(q).int64_array_value ();
-
-                  retval = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_int32_matrix::static_type_id ()
-                       || args(q).type_id () == octave_int32_scalar::static_type_id ())
-                {
-                  int32NDArray x (dx);
-                  int32NDArray y = args(q).int32_array_value ();
+              uint64NDArray x (args(p).array_value ());
+              uint64NDArray y (args(q).float_array_value ());
 
-                  retval = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_int16_matrix::static_type_id ()
-                       || args(q).type_id () == octave_int16_scalar::static_type_id ())
-                {
-                  int16NDArray x (dx);
-                  int16NDArray y = args(q).int16_array_value ();
-
-                  retval  = bitopx (fname, x, y);
-                }
-              else if (args(q).type_id () == octave_int8_matrix::static_type_id ()
-                       || args(q).type_id () == octave_int8_scalar::static_type_id ())
-                {
-                  int8NDArray x (dx);
-                  int8NDArray y = args(q).int8_array_value ();
-
-                  retval = bitopx (fname, x, y);
-                }
-              else
-                error ("%s: invalid operand type", fname.c_str ());
+              retval = bitopx (fname, x, y).float_array_value ();
             }
         }
-      else if (args(0).class_name () == args(1).class_name ())
+      else
         {
-          if (args(0).type_id () == octave_uint64_matrix::static_type_id ()
-              || args(0).type_id () == octave_uint64_scalar::static_type_id ())
+          int p = (arg0_is_int ? 1 : 0);
+          int q = (arg0_is_int ? 0 : 1);
+
+          NDArray dx = args(p).array_value ();
+
+          if (args(q).type_id () == octave_uint64_matrix::static_type_id ()
+              || args(q).type_id () == octave_uint64_scalar::static_type_id ())
             {
-              uint64NDArray x = args(0).uint64_array_value ();
-              uint64NDArray y = args(1).uint64_array_value ();
+              uint64NDArray x (dx);
+              uint64NDArray y = args(q).uint64_array_value ();
+
+              retval = bitopx (fname, x, y);
+            }
+          else if (args(q).type_id () == octave_uint32_matrix::static_type_id ()
+                   || args(q).type_id () == octave_uint32_scalar::static_type_id ())
+            {
+              uint32NDArray x (dx);
+              uint32NDArray y = args(q).uint32_array_value ();
 
               retval = bitopx (fname, x, y);
             }
-          else if (args(0).type_id () == octave_uint32_matrix::static_type_id ()
-                   || args(0).type_id () == octave_uint32_scalar::static_type_id ())
+          else if (args(q).type_id () == octave_uint16_matrix::static_type_id ()
+                   || args(q).type_id () == octave_uint16_scalar::static_type_id ())
             {
-              uint32NDArray x = args(0).uint32_array_value ();
-              uint32NDArray y = args(1).uint32_array_value ();
+              uint16NDArray x (dx);
+              uint16NDArray y = args(q).uint16_array_value ();
 
               retval = bitopx (fname, x, y);
             }
-          else if (args(0).type_id () == octave_uint16_matrix::static_type_id ()
-                   || args(0).type_id () == octave_uint16_scalar::static_type_id ())
+          else if (args(q).type_id () == octave_uint8_matrix::static_type_id ()
+                   || args(q).type_id () == octave_uint8_scalar::static_type_id ())
             {
-              uint16NDArray x = args(0).uint16_array_value ();
-              uint16NDArray y = args(1).uint16_array_value ();
-
-              retval = bitopx (fname, x, y);
-            }
-          else if (args(0).type_id () == octave_uint8_matrix::static_type_id ()
-                   || args(0).type_id () == octave_uint8_scalar::static_type_id ())
-            {
-              uint8NDArray x = args(0).uint8_array_value ();
-              uint8NDArray y = args(1).uint8_array_value ();
+              uint8NDArray x (dx);
+              uint8NDArray y = args(q).uint8_array_value ();
 
               retval = bitopx (fname, x, y);
             }
-          else if (args(0).type_id () == octave_int64_matrix::static_type_id ()
-                   || args(0).type_id () == octave_int64_scalar::static_type_id ())
+          else if (args(q).type_id () == octave_int64_matrix::static_type_id ()
+                   || args(q).type_id () == octave_int64_scalar::static_type_id ())
             {
-              int64NDArray x = args(0).int64_array_value ();
-              int64NDArray y = args(1).int64_array_value ();
+              int64NDArray x (dx);
+              int64NDArray y = args(q).int64_array_value ();
 
               retval = bitopx (fname, x, y);
             }
-          else if (args(0).type_id () == octave_int32_matrix::static_type_id ()
-                   || args(0).type_id () == octave_int32_scalar::static_type_id ())
+          else if (args(q).type_id () == octave_int32_matrix::static_type_id ()
+                   || args(q).type_id () == octave_int32_scalar::static_type_id ())
             {
-              int32NDArray x = args(0).int32_array_value ();
-              int32NDArray y = args(1).int32_array_value ();
+              int32NDArray x (dx);
+              int32NDArray y = args(q).int32_array_value ();
 
               retval = bitopx (fname, x, y);
             }
-          else if (args(0).type_id () == octave_int16_matrix::static_type_id ()
-                   || args(0).type_id () == octave_int16_scalar::static_type_id ())
+          else if (args(q).type_id () == octave_int16_matrix::static_type_id ()
+                   || args(q).type_id () == octave_int16_scalar::static_type_id ())
             {
-              int16NDArray x = args(0).int16_array_value ();
-              int16NDArray y = args(1).int16_array_value ();
+              int16NDArray x (dx);
+              int16NDArray y = args(q).int16_array_value ();
 
-              retval = bitopx (fname, x, y);
+              retval  = bitopx (fname, x, y);
             }
-          else if (args(0).type_id () == octave_int8_matrix::static_type_id ()
-                   || args(0).type_id () == octave_int8_scalar::static_type_id ())
+          else if (args(q).type_id () == octave_int8_matrix::static_type_id ()
+                   || args(q).type_id () == octave_int8_scalar::static_type_id ())
             {
-              int8NDArray x = args(0).int8_array_value ();
-              int8NDArray y = args(1).int8_array_value ();
+              int8NDArray x (dx);
+              int8NDArray y = args(q).int8_array_value ();
 
               retval = bitopx (fname, x, y);
             }
           else
             error ("%s: invalid operand type", fname.c_str ());
         }
+    }
+  else if (args(0).class_name () == args(1).class_name ())
+    {
+      if (args(0).type_id () == octave_uint64_matrix::static_type_id ()
+          || args(0).type_id () == octave_uint64_scalar::static_type_id ())
+        {
+          uint64NDArray x = args(0).uint64_array_value ();
+          uint64NDArray y = args(1).uint64_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_uint32_matrix::static_type_id ()
+               || args(0).type_id () == octave_uint32_scalar::static_type_id ())
+        {
+          uint32NDArray x = args(0).uint32_array_value ();
+          uint32NDArray y = args(1).uint32_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_uint16_matrix::static_type_id ()
+               || args(0).type_id () == octave_uint16_scalar::static_type_id ())
+        {
+          uint16NDArray x = args(0).uint16_array_value ();
+          uint16NDArray y = args(1).uint16_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_uint8_matrix::static_type_id ()
+               || args(0).type_id () == octave_uint8_scalar::static_type_id ())
+        {
+          uint8NDArray x = args(0).uint8_array_value ();
+          uint8NDArray y = args(1).uint8_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_int64_matrix::static_type_id ()
+               || args(0).type_id () == octave_int64_scalar::static_type_id ())
+        {
+          int64NDArray x = args(0).int64_array_value ();
+          int64NDArray y = args(1).int64_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_int32_matrix::static_type_id ()
+               || args(0).type_id () == octave_int32_scalar::static_type_id ())
+        {
+          int32NDArray x = args(0).int32_array_value ();
+          int32NDArray y = args(1).int32_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_int16_matrix::static_type_id ()
+               || args(0).type_id () == octave_int16_scalar::static_type_id ())
+        {
+          int16NDArray x = args(0).int16_array_value ();
+          int16NDArray y = args(1).int16_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
+      else if (args(0).type_id () == octave_int8_matrix::static_type_id ()
+               || args(0).type_id () == octave_int8_scalar::static_type_id ())
+        {
+          int8NDArray x = args(0).int8_array_value ();
+          int8NDArray y = args(1).int8_array_value ();
+
+          retval = bitopx (fname, x, y);
+        }
       else
-        error ("%s: must have matching operand types", fname.c_str ());
+        error ("%s: invalid operand type", fname.c_str ());
     }
   else
-    print_usage ();
+    error ("%s: must have matching operand types", fname.c_str ());
 
   return retval;
 }
@@ -570,82 +566,80 @@
 
   int nargin = args.length ();
 
-  if (nargin == 2 || nargin == 3)
-    {
-      int nbits = 64;
+  if (nargin < 2 || nargin > 3)
+    print_usage ();
+
+  int nbits = 64;
+
+  NDArray n = args(1).xarray_value ("bitshift: K must be a scalar or array of integers");
 
-      NDArray n = args(1).xarray_value ("bitshift: K must be a scalar or array of integers");
-
-      if (nargin == 3)
+  if (nargin == 3)
+    {
+      // FIXME: for compatibility, we should accept an array
+      // or a scalar as the third argument.
+      if (args(2).numel () > 1)
+        error ("bitshift: N must be a scalar integer");
+      else
         {
-          // FIXME: for compatibility, we should accept an array
-          // or a scalar as the third argument.
-          if (args(2).numel () > 1)
-            error ("bitshift: N must be a scalar integer");
-          else
-            {
-              nbits = args(2).xint_value ("bitshift: N must be an integer");
+          nbits = args(2).xint_value ("bitshift: N must be an integer");
 
-              if (nbits < 0)
-                error ("bitshift: N must be positive");
-            }
+          if (nbits < 0)
+            error ("bitshift: N must be positive");
         }
+    }
 
-      octave_value m_arg = args(0);
-      std::string cname = m_arg.class_name ();
+  octave_value m_arg = args(0);
+  std::string cname = m_arg.class_name ();
 
-      if (cname == "uint8")
-        DO_UBITSHIFT (uint8, nbits < 8 ? nbits : 8);
-      else if (cname == "uint16")
-        DO_UBITSHIFT (uint16, nbits < 16 ? nbits : 16);
-      else if (cname == "uint32")
-        DO_UBITSHIFT (uint32, nbits < 32 ? nbits : 32);
-      else if (cname == "uint64")
-        DO_UBITSHIFT (uint64, nbits < 64 ? nbits : 64);
-      else if (cname == "int8")
-        DO_SBITSHIFT (int8, nbits < 8 ? nbits : 8);
-      else if (cname == "int16")
-        DO_SBITSHIFT (int16, nbits < 16 ? nbits : 16);
-      else if (cname == "int32")
-        DO_SBITSHIFT (int32, nbits < 32 ? nbits : 32);
-      else if (cname == "int64")
-        DO_SBITSHIFT (int64, nbits < 64 ? nbits : 64);
-      else if (cname == "double")
-        {
-          static const int bits_in_mantissa
-            = std::numeric_limits<double>::digits;
+  if (cname == "uint8")
+    DO_UBITSHIFT (uint8, nbits < 8 ? nbits : 8);
+  else if (cname == "uint16")
+    DO_UBITSHIFT (uint16, nbits < 16 ? nbits : 16);
+  else if (cname == "uint32")
+    DO_UBITSHIFT (uint32, nbits < 32 ? nbits : 32);
+  else if (cname == "uint64")
+    DO_UBITSHIFT (uint64, nbits < 64 ? nbits : 64);
+  else if (cname == "int8")
+    DO_SBITSHIFT (int8, nbits < 8 ? nbits : 8);
+  else if (cname == "int16")
+    DO_SBITSHIFT (int16, nbits < 16 ? nbits : 16);
+  else if (cname == "int32")
+    DO_SBITSHIFT (int32, nbits < 32 ? nbits : 32);
+  else if (cname == "int64")
+    DO_SBITSHIFT (int64, nbits < 64 ? nbits : 64);
+  else if (cname == "double")
+    {
+      static const int bits_in_mantissa
+        = std::numeric_limits<double>::digits;
 
-          nbits = (nbits < bits_in_mantissa ? nbits : bits_in_mantissa);
-          int64_t mask = max_mantissa_value<double> ();
-          if (nbits < bits_in_mantissa)
-            mask = mask >> (bits_in_mantissa - nbits);
-          else if (nbits < 1)
-            mask = 0;
-          int bits_in_type = sizeof (double)
-                             * std::numeric_limits<unsigned char>::digits;
-          NDArray m = m_arg.array_value ();
-          DO_BITSHIFT ();
-        }
-      else if (cname == "single")
-        {
-          static const int bits_in_mantissa
-            = std::numeric_limits<float>::digits;
-          nbits = (nbits < bits_in_mantissa ? nbits : bits_in_mantissa);
-          int64_t mask = max_mantissa_value<float> ();
-          if (nbits < bits_in_mantissa)
-            mask = mask >> (bits_in_mantissa - nbits);
-          else if (nbits < 1)
-            mask = 0;
-          int bits_in_type = sizeof (float)
-                             * std::numeric_limits<unsigned char>::digits;
-          FloatNDArray m = m_arg.float_array_value ();
-          DO_BITSHIFT (Float);
-        }
-      else
-        error ("bitshift: not defined for %s objects", cname.c_str ());
+      nbits = (nbits < bits_in_mantissa ? nbits : bits_in_mantissa);
+      int64_t mask = max_mantissa_value<double> ();
+      if (nbits < bits_in_mantissa)
+        mask = mask >> (bits_in_mantissa - nbits);
+      else if (nbits < 1)
+        mask = 0;
+      int bits_in_type = sizeof (double)
+        * std::numeric_limits<unsigned char>::digits;
+      NDArray m = m_arg.array_value ();
+      DO_BITSHIFT ();
+    }
+  else if (cname == "single")
+    {
+      static const int bits_in_mantissa
+        = std::numeric_limits<float>::digits;
+      nbits = (nbits < bits_in_mantissa ? nbits : bits_in_mantissa);
+      int64_t mask = max_mantissa_value<float> ();
+      if (nbits < bits_in_mantissa)
+        mask = mask >> (bits_in_mantissa - nbits);
+      else if (nbits < 1)
+        mask = 0;
+      int bits_in_type = sizeof (float)
+        * std::numeric_limits<unsigned char>::digits;
+      FloatNDArray m = m_arg.float_array_value ();
+      DO_BITSHIFT (Float);
     }
   else
-    print_usage ();
+    error ("bitshift: not defined for %s objects", cname.c_str ());
 
   return retval;
 }
@@ -678,16 +672,16 @@
 @end deftypefn")
 {
   octave_value retval;
+
   std::string cname = "double";
+
   int nargin = args.length ();
 
-  if (nargin == 1 && args(0).is_string ())
-    cname = args(0).string_value ();
-  else if (nargin != 0)
-    {
-      print_usage ();
-      return retval;
-    }
+  if (nargin > 1)
+    print_usage ();
+
+  if (nargin == 1)
+    cname = args(0).xstring_value ("flintmax: argument must be a string");
 
   if (cname == "double")
     retval = (static_cast<double> (max_mantissa_value<double> () + 1));
@@ -737,16 +731,16 @@
 @end deftypefn")
 {
   octave_value retval;
+
   std::string cname = "int32";
+
   int nargin = args.length ();
 
-  if (nargin == 1 && args(0).is_string ())
-    cname = args(0).string_value ();
-  else if (nargin != 0)
-    {
-      print_usage ();
-      return retval;
-    }
+  if (nargin > 1)
+    print_usage ();
+
+  if (nargin == 1)
+    cname = args(0).xstring_value ("intmax: argument must be a string");
 
   if (cname == "uint8")
     retval = octave_uint8 (std::numeric_limits<uint8_t>::max ());
@@ -808,16 +802,16 @@
 @end deftypefn")
 {
   octave_value retval;
+
   std::string cname = "int32";
+
   int nargin = args.length ();
 
-  if (nargin == 1 && args(0).is_string ())
-    cname = args(0).string_value ();
-  else if (nargin != 0)
-    {
-      print_usage ();
-      return retval;
-    }
+  if (nargin > 1)
+    print_usage ();
+
+  if (nargin == 1)
+    cname = args(0).xstring_value ("intmin: argument must be a string");
 
   if (cname == "uint8")
     retval = octave_uint8 (std::numeric_limits<uint8_t>::min ());
@@ -853,12 +847,8 @@
 @seealso{intmax}\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  if (args.length () == 0)
-    retval = octave_int<octave_idx_type> (dim_vector::dim_max ());
-  else
+  if (args.length () != 0)
     print_usage ();
 
-  return retval;
+  return octave_value (octave_int<octave_idx_type> (dim_vector::dim_max ()));
 }
--- a/libinterp/corefcn/cellfun.cc	Fri Dec 04 14:06:41 2015 -0500
+++ b/libinterp/corefcn/cellfun.cc	Fri Dec 04 13:16:59 2015 -0500
@@ -416,20 +416,12 @@
   int nargout1 = (nargout < 1 ? 1 : nargout);
 
   if (nargin < 2)
-    {
-      error ("cellfun: function requires at least 2 arguments");
-      print_usage ();
-      return retval;
-    }
+    print_usage ();
 
   octave_value func = args(0);
 
   if (! args(1).is_cell ())
-    {
-      error ("cellfun: C must be a cell array");
-
-      return retval;
-    }
+    error ("cellfun: C must be a cell array");
 
   if (func.is_string ())
     {
@@ -1167,12 +1159,7 @@
   int nargout1 = (nargout < 1 ? 1 : nargout);
 
   if (nargin < 2)
-    {
-      error_with_id ("Octave:invalid-fun-call",
-                     "arrayfun: function requires at least 2 arguments");
-      print_usage ();
-      return retval;
-    }
+    print_usage ();
 
   octave_value func = args(0);
   bool symbol_table_lookup = false;
@@ -1855,67 +1842,68 @@
 @seealso{mat2cell}\n\
 @end deftypefn")
 {
+  octave_value retval;
+
   int nargin =  args.length ();
-  octave_value retval;
 
   if (nargin < 1 || nargin > 2)
     print_usage ();
-  else
+
+  octave_value array = args(0);
+
+  Array<int> dimv;
+
+  if (nargin > 1)
+    dimv = args(1).int_vector_value (true);
+
+  if (array.is_bool_type ())
+    retval = do_num2cell (array.bool_array_value (), dimv);
+  else if (array.is_char_matrix ())
+    retval = do_num2cell (array.char_array_value (), dimv);
+  else if (array.is_numeric_type ())
     {
-      octave_value array = args(0);
-      Array<int> dimv;
-      if (nargin > 1)
-        dimv = args(1).int_vector_value (true);
-
-      if (array.is_bool_type ())
-        retval = do_num2cell (array.bool_array_value (), dimv);
-      else if (array.is_char_matrix ())
-        retval = do_num2cell (array.char_array_value (), dimv);
-      else if (array.is_numeric_type ())
+      if (array.is_integer_type ())
         {
-          if (array.is_integer_type ())
-            {
-              if (array.is_int8_type ())
-                retval = do_num2cell (array.int8_array_value (), dimv);
-              else if (array.is_int16_type ())
-                retval = do_num2cell (array.int16_array_value (), dimv);
-              else if (array.is_int32_type ())
-                retval = do_num2cell (array.int32_array_value (), dimv);
-              else if (array.is_int64_type ())
-                retval = do_num2cell (array.int64_array_value (), dimv);
-              else if (array.is_uint8_type ())
-                retval = do_num2cell (array.uint8_array_value (), dimv);
-              else if (array.is_uint16_type ())
-                retval = do_num2cell (array.uint16_array_value (), dimv);
-              else if (array.is_uint32_type ())
-                retval = do_num2cell (array.uint32_array_value (), dimv);
-              else if (array.is_uint64_type ())
-                retval = do_num2cell (array.uint64_array_value (), dimv);
-            }
-          else if (array.is_complex_type ())
-            {
-              if (array.is_single_type ())
-                retval = do_num2cell (array.float_complex_array_value (), dimv);
-              else
-                retval = do_num2cell (array.complex_array_value (), dimv);
-            }
+          if (array.is_int8_type ())
+            retval = do_num2cell (array.int8_array_value (), dimv);
+          else if (array.is_int16_type ())
+            retval = do_num2cell (array.int16_array_value (), dimv);
+          else if (array.is_int32_type ())
+            retval = do_num2cell (array.int32_array_value (), dimv);
+          else if (array.is_int64_type ())
+            retval = do_num2cell (array.int64_array_value (), dimv);
+          else if (array.is_uint8_type ())
+            retval = do_num2cell (array.uint8_array_value (), dimv);
+          else if (array.is_uint16_type ())
+            retval = do_num2cell (array.uint16_array_value (), dimv);
+          else if (array.is_uint32_type ())
+            retval = do_num2cell (array.uint32_array_value (), dimv);
+          else if (array.is_uint64_type ())
+            retval = do_num2cell (array.uint64_array_value (), dimv);
+        }
+      else if (array.is_complex_type ())
+        {
+          if (array.is_single_type ())
+            retval = do_num2cell (array.float_complex_array_value (), dimv);
           else
-            {
-              if (array.is_single_type ())
-                retval = do_num2cell (array.float_array_value (), dimv);
-              else
-                retval = do_num2cell (array.array_value (), dimv);
-            }
+            retval = do_num2cell (array.complex_array_value (), dimv);
+        }
+      else
+        {
+          if (array.is_single_type ())
+            retval = do_num2cell (array.float_array_value (), dimv);
+          else
+            retval = do_num2cell (array.array_value (), dimv);
         }
-      else if (array.is_object ())
-        retval = do_object2cell (array, dimv);
-      else if (array.is_map ())
-        retval = do_num2cell (array.map_value (), dimv);
-      else if (array.is_cell ())
-        retval = do_num2cell (array.cell_value (), dimv);
-      else
-        gripe_wrong_type_arg ("num2cell", array);
     }
+  else if (array.is_object ())
+    retval = do_object2cell (array, dimv);
+  else if (array.is_map ())
+    retval = do_num2cell (array.map_value (), dimv);
+  else if (array.is_cell ())
+    retval = do_num2cell (array.cell_value (), dimv);
+  else
+    gripe_wrong_type_arg ("num2cell", array);
 
   return retval;
 }
@@ -2189,75 +2177,79 @@
 @seealso{num2cell, cell2mat}\n\
 @end deftypefn")
 {
+  octave_value retval;
+
   int nargin = args.length ();
-  octave_value retval;
 
   if (nargin < 2)
     print_usage ();
-  else
-    {
-      // Prepare indices.
-      OCTAVE_LOCAL_BUFFER (Array<octave_idx_type>, d, nargin-1);
 
-      for (int i = 1; i < nargin; i++)
-        d[i-1] = args(i).octave_idx_type_vector_value (true);
+  // Prepare indices.
+  OCTAVE_LOCAL_BUFFER (Array<octave_idx_type>, d, nargin-1);
+
+  for (int i = 1; i < nargin; i++)
+    d[i-1] = args(i).octave_idx_type_vector_value (true);
 
-      octave_value a = args(0);
-      bool sparse = a.is_sparse_type ();
-      if (sparse && nargin > 3)
-        {
-          error ("mat2cell: sparse arguments only support 2-D indexing");
-          return retval;
-        }
+  octave_value a = args(0);
+  bool sparse = a.is_sparse_type ();
+  if (sparse && nargin > 3)
+    {
+      error ("mat2cell: sparse arguments only support 2-D indexing");
+      return retval;
+    }
+
+  switch (a.builtin_type ())
+    {
+    case btyp_double:
+      {
+        if (sparse)
+          retval = do_mat2cell_2d (a.sparse_matrix_value (), d, nargin-1);
+        else
+          retval = do_mat2cell (a.array_value (), d, nargin - 1);
+      }
+      break;
 
-      switch (a.builtin_type ())
-        {
-        case btyp_double:
-          {
-            if (sparse)
-              retval = do_mat2cell_2d (a.sparse_matrix_value (), d, nargin-1);
-            else
-              retval = do_mat2cell (a.array_value (), d, nargin - 1);
-            break;
-          }
-        case btyp_complex:
-          {
-            if (sparse)
-              retval = do_mat2cell_2d (a.sparse_complex_matrix_value (), d,
-                                       nargin-1);
-            else
-              retval = do_mat2cell (a.complex_array_value (), d, nargin - 1);
-            break;
-          }
-#define BTYP_BRANCH(X,Y) \
-        case btyp_ ## X: \
-            retval = do_mat2cell (a.Y ## _value (), d, nargin - 1); \
-          break
+    case btyp_complex:
+      {
+        if (sparse)
+          retval = do_mat2cell_2d (a.sparse_complex_matrix_value (), d,
+                                   nargin-1);
+        else
+          retval = do_mat2cell (a.complex_array_value (), d, nargin - 1);
+      }
+      break;
+
+#define BTYP_BRANCH(X, Y) \
+  case btyp_ ## X: \
+    retval = do_mat2cell (a.Y ## _value (), d, nargin - 1); \
+    break
 
-        BTYP_BRANCH (float, float_array);
-        BTYP_BRANCH (float_complex, float_complex_array);
-        BTYP_BRANCH (bool, bool_array);
-        BTYP_BRANCH (char, char_array);
+      BTYP_BRANCH (float, float_array);
+      BTYP_BRANCH (float_complex, float_complex_array);
+      BTYP_BRANCH (bool, bool_array);
+      BTYP_BRANCH (char, char_array);
 
-        BTYP_BRANCH (int8,  int8_array);
-        BTYP_BRANCH (int16, int16_array);
-        BTYP_BRANCH (int32, int32_array);
-        BTYP_BRANCH (int64, int64_array);
-        BTYP_BRANCH (uint8,  uint8_array);
-        BTYP_BRANCH (uint16, uint16_array);
-        BTYP_BRANCH (uint32, uint32_array);
-        BTYP_BRANCH (uint64, uint64_array);
+      BTYP_BRANCH (int8,  int8_array);
+      BTYP_BRANCH (int16, int16_array);
+      BTYP_BRANCH (int32, int32_array);
+      BTYP_BRANCH (int64, int64_array);
+      BTYP_BRANCH (uint8,  uint8_array);
+      BTYP_BRANCH (uint16, uint16_array);
+      BTYP_BRANCH (uint32, uint32_array);
+      BTYP_BRANCH (uint64, uint64_array);
 
-        BTYP_BRANCH (cell, cell);
-        BTYP_BRANCH (struct, map);
+      BTYP_BRANCH (cell, cell);
+      BTYP_BRANCH (struct, map);
+
 #undef BTYP_BRANCH
 
-        case btyp_func_handle:
-          gripe_wrong_type_arg ("mat2cell", a);
-          break;
-        default:
-          retval = do_mat2cell (a, d, nargin-1);
-        }
+    case btyp_func_handle:
+      gripe_wrong_type_arg ("mat2cell", a);
+      break;
+
+    default:
+      retval = do_mat2cell (a, d, nargin-1);
+      break;
     }
 
   return retval;
@@ -2338,103 +2330,103 @@
 @end deftypefn")
 {
   octave_value retval;
+
   int nargin = args.length ();
-  if (nargin == 3 || nargin == 4)
+
+  if (nargin < 3 || nargin > 4)
+    print_usage ();
+
+  octave_value x = args(0);
+  Array<octave_idx_type> lb = args(1).octave_idx_type_vector_value ();
+  Array<octave_idx_type> ub = args(2).octave_idx_type_vector_value ();
+  int dim = -1;
+  if (nargin == 4)
     {
-      octave_value x = args(0);
-      Array<octave_idx_type> lb = args(1).octave_idx_type_vector_value ();
-      Array<octave_idx_type> ub = args(2).octave_idx_type_vector_value ();
-      int dim = -1;
-      if (nargin == 4)
-        {
-          dim = args(3).int_value () - 1;
-          if (dim < 0)
-            error ("cellslices: DIM must be a valid dimension");
-        }
+      dim = args(3).int_value () - 1;
+      if (dim < 0)
+        error ("cellslices: DIM must be a valid dimension");
+    }
 
-      if (lb.numel () != ub.numel ())
-        error ("cellslices: the lengths of LB and UB must match");
-      else
+  if (lb.numel () != ub.numel ())
+    error ("cellslices: the lengths of LB and UB must match");
+  else
+    {
+      Cell retcell;
+      if (! x.is_sparse_type () && x.is_matrix_type ())
         {
-          Cell retcell;
-          if (! x.is_sparse_type () && x.is_matrix_type ())
+          // specialize for some dense arrays.
+          if (x.is_bool_type ())
+            retcell = do_cellslices_nda (x.bool_array_value (),
+                                         lb, ub, dim);
+          else if (x.is_char_matrix ())
+            retcell = do_cellslices_nda (x.char_array_value (),
+                                         lb, ub, dim);
+          else if (x.is_integer_type ())
             {
-              // specialize for some dense arrays.
-              if (x.is_bool_type ())
-                retcell = do_cellslices_nda (x.bool_array_value (),
-                                             lb, ub, dim);
-              else if (x.is_char_matrix ())
-                retcell = do_cellslices_nda (x.char_array_value (),
+              if (x.is_int8_type ())
+                retcell = do_cellslices_nda (x.int8_array_value (),
                                              lb, ub, dim);
-              else if (x.is_integer_type ())
-                {
-                  if (x.is_int8_type ())
-                    retcell = do_cellslices_nda (x.int8_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_int16_type ())
-                    retcell = do_cellslices_nda (x.int16_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_int32_type ())
-                    retcell = do_cellslices_nda (x.int32_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_int64_type ())
-                    retcell = do_cellslices_nda (x.int64_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_uint8_type ())
-                    retcell = do_cellslices_nda (x.uint8_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_uint16_type ())
-                    retcell = do_cellslices_nda (x.uint16_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_uint32_type ())
-                    retcell = do_cellslices_nda (x.uint32_array_value (),
-                                                 lb, ub, dim);
-                  else if (x.is_uint64_type ())
-                    retcell = do_cellslices_nda (x.uint64_array_value (),
-                                                 lb, ub, dim);
-                }
-              else if (x.is_complex_type ())
-                {
-                  if (x.is_single_type ())
-                    retcell = do_cellslices_nda (x.float_complex_array_value (),
-                                                 lb, ub, dim);
-                  else
-                    retcell = do_cellslices_nda (x.complex_array_value (),
-                                                 lb, ub, dim);
-                }
+              else if (x.is_int16_type ())
+                retcell = do_cellslices_nda (x.int16_array_value (),
+                                             lb, ub, dim);
+              else if (x.is_int32_type ())
+                retcell = do_cellslices_nda (x.int32_array_value (),
+                                             lb, ub, dim);
+              else if (x.is_int64_type ())
+                retcell = do_cellslices_nda (x.int64_array_value (),
+                                             lb, ub, dim);
+              else if (x.is_uint8_type ())
+                retcell = do_cellslices_nda (x.uint8_array_value (),
+                                             lb, ub, dim);
+              else if (x.is_uint16_type ())
+                retcell = do_cellslices_nda (x.uint16_array_value (),
+                                             lb, ub, dim);
+              else if (x.is_uint32_type ())
+                retcell = do_cellslices_nda (x.uint32_array_value (),
+                                             lb, ub, dim);
+              else if (x.is_uint64_type ())
+                retcell = do_cellslices_nda (x.uint64_array_value (),
+                                             lb, ub, dim);
+            }
+          else if (x.is_complex_type ())
+            {
+              if (x.is_single_type ())
+                retcell = do_cellslices_nda (x.float_complex_array_value (),
+                                             lb, ub, dim);
               else
-                {
-                  if (x.is_single_type ())
-                    retcell = do_cellslices_nda (x.float_array_value (),
-                                                 lb, ub, dim);
-                  else
-                    retcell = do_cellslices_nda (x.array_value (),
-                                                 lb, ub, dim);
-                }
+                retcell = do_cellslices_nda (x.complex_array_value (),
+                                             lb, ub, dim);
             }
           else
             {
-              // generic code.
-              octave_idx_type n = lb.numel ();
-              retcell = Cell (1, n);
-              const dim_vector dv = x.dims ();
-              int ndims = dv.length ();
-              if (dim < 0)
-                dim = dv.first_non_singleton ();
-              ndims = std::max (ndims, dim + 1);
-              octave_value_list idx (ndims, octave_value::magic_colon_t);
-              for (octave_idx_type i = 0; i < n; i++)
-                {
-                  idx(dim) = Range (lb(i), ub(i));
-                  retcell(i) = x.do_index_op (idx);
-                }
+              if (x.is_single_type ())
+                retcell = do_cellslices_nda (x.float_array_value (),
+                                             lb, ub, dim);
+              else
+                retcell = do_cellslices_nda (x.array_value (),
+                                             lb, ub, dim);
             }
-
-          retval = retcell;
         }
+      else
+        {
+          // generic code.
+          octave_idx_type n = lb.numel ();
+          retcell = Cell (1, n);
+          const dim_vector dv = x.dims ();
+          int ndims = dv.length ();
+          if (dim < 0)
+            dim = dv.first_non_singleton ();
+          ndims = std::max (ndims, dim + 1);
+          octave_value_list idx (ndims, octave_value::magic_colon_t);
+          for (octave_idx_type i = 0; i < n; i++)
+            {
+              idx(dim) = Range (lb(i), ub(i));
+              retcell(i) = x.do_index_op (idx);
+            }
+        }
+
+      retval = retcell;
     }
-  else
-    print_usage ();
 
   return retval;
 }
@@ -2464,28 +2456,22 @@
 @seealso{cellslices, cellfun}\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  if (args.length () >= 1)
-    {
-      const Cell x = args(0).xcell_value ("cellindexmat: X must be a cell");
-      NoAlias<Cell> y(x.dims ());
-      octave_idx_type nel = x.numel ();
-      octave_value_list idx = args.slice (1, args.length () - 1);
-
-      for (octave_idx_type i = 0; i < nel; i++)
-        {
-          octave_quit ();
-
-          octave_value tmp = x(i);
-
-          y(i) = tmp.do_index_op (idx);
-        }
-
-      retval = y;
-    }
-  else
+  if (args.length () == 0)
     print_usage ();
 
-  return retval;
+  const Cell x = args(0).xcell_value ("cellindexmat: X must be a cell");
+  NoAlias<Cell> y(x.dims ());
+  octave_idx_type nel = x.numel ();
+  octave_value_list idx = args.slice (1, args.length () - 1);
+
+  for (octave_idx_type i = 0; i < nel; i++)
+    {
+      octave_quit ();
+
+      octave_value tmp = x(i);
+
+      y(i) = tmp.do_index_op (idx);
+    }
+
+  return octave_value (y);
 }
--- a/libinterp/corefcn/debug.cc	Fri Dec 04 14:06:41 2015 -0500
+++ b/libinterp/corefcn/debug.cc	Fri Dec 04 13:16:59 2015 -0500
@@ -1149,6 +1149,9 @@
 
   // dbstack accepts up to 2 arguments.
 
+  if (len > 2)
+    print_usage ();
+
   if (len == 1 || len == 2)
     {
       int n = 0;
@@ -1178,8 +1181,6 @@
       if (n > 0)
         nskip = n;
     }
-  else if (len)
-    print_usage ();
 
   if (nargout == 0)
     {
@@ -1387,7 +1388,8 @@
 
       if (nargin > 1)
         print_usage ();
-      else if (nargin == 1)
+
+      if (nargin == 1)
         {
           std::string arg = args(0).xstring_value ("dbstep: input argument must be a string");
 
@@ -1441,14 +1443,12 @@
 {
   if (Vdebugging)
     {
-      if (args.length () == 0)
-        {
-          Vdebugging = false;
+      if (args.length () != 0)
+        print_usage ();
 
-          tree_evaluator::reset_debug_state ();
-        }
-      else
-        print_usage ();
+      Vdebugging = false;
+
+      tree_evaluator::reset_debug_state ();
     }
   else
     error ("dbcont: can only be called in debug mode");
@@ -1466,16 +1466,14 @@
 {
   if (Vdebugging)
     {
-      if (args.length () == 0)
-        {
-          Vdebugging = false;
+      if (args.length () != 0)
+        print_usage ();
 
-          tree_evaluator::reset_debug_state ();
+      Vdebugging = false;
 
-          octave_throw_interrupt_exception ();
-        }
-      else
-        print_usage ();
+      tree_evaluator::reset_debug_state ();
+
+      octave_throw_interrupt_exception ();
     }
   else
     error ("dbquit: can only be called in debug mode");
@@ -1490,14 +1488,10 @@
 @seealso{dbwhere, dbstack, dbstatus}\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  if (args.length () == 0)
-    retval = Vdebugging;
-  else
+  if (args.length () != 0)
     print_usage ();
 
-  return retval;
+  return octave_value (Vdebugging);
 }
 
 DEFUN (__db_next_breakpoint_quiet__, args, ,
@@ -1513,17 +1507,15 @@
 
   int nargin = args.length ();
 
-  if (nargin == 0 || nargin == 1)
-    {
-      bool state = true;
+  if (nargin > 1)
+    print_usage ();
+
+  bool state = true;
 
-      if (nargin == 1)
-        state = args(0).bool_value ();
+  if (nargin == 1)
+    state = args(0).bool_value ();
 
-      tree_evaluator::quiet_breakpoint_flag = state;
-    }
-  else
-    print_usage ();
+  tree_evaluator::quiet_breakpoint_flag = state;
 
   return retval;
 }
--- a/libinterp/corefcn/dirfns.cc	Fri Dec 04 14:06:41 2015 -0500
+++ b/libinterp/corefcn/dirfns.cc	Fri Dec 04 13:16:59 2015 -0500
@@ -178,29 +178,25 @@
 {
   octave_value_list retval;
 
+  if (args.length () != 1)
+    print_usage ();
+
   retval(2) = std::string ();
   retval(1) = -1.0;
   retval(0) = Cell ();
 
-  if (args.length () == 1)
-    {
-      std::string dirname = args(0).xstring_value ("readdir: DIR must be a string");
+  std::string dirname = args(0).xstring_value ("readdir: DIR must be a string");
 
-      dir_entry dir (dirname);
+  dir_entry dir (dirname);
 
-      if (dir)
-        {
-          string_vector dirlist = dir.read ();
-          retval(1) = 0.0;
-          retval(0) = Cell (dirlist.sort ());
-        }
-      else
-        {
-          retval(2) = dir.error ();
-        }
+  if (dir)
+    {
+      string_vector dirlist = dir.read ();
+      retval(1) = 0.0;
+      retval(0) = Cell (dirlist.sort ());
     }
   else
-    print_usage ();
+    retval(2) = dir.error ();
 
   return retval;
 }
@@ -230,12 +226,15 @@
 {
   octave_value_list retval;
 
+  int nargin = args.length ();
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+
   retval(2) = std::string ();
   retval(1) = std::string ();
   retval(0) = false;
 
-  int nargin = args.length ();
-
   std::string dirname;
 
   if (nargin == 2)
@@ -248,38 +247,33 @@
   else if (nargin == 1)
     dirname = args(0).xstring_value ("mkdir: DIR must be a string");
 
-  if (nargin == 1 || nargin == 2)
-    {
-      std::string msg;
+  std::string msg;
+
+  dirname = file_ops::tilde_expand (dirname);
 
-      dirname = file_ops::tilde_expand (dirname);
+  file_stat fs (dirname);
 
-      file_stat fs (dirname);
+  if (fs && fs.is_dir ())
+    {
+      // For compatibility with Matlab, we return true when the
+      // directory already exists.
 
-      if (fs && fs.is_dir ())
+      retval(2) = "mkdir";
+      retval(1) = "directory exists";
+      retval(0) = true;
+    }
+  else
+    {
+      int status = octave_mkdir (dirname, 0777, msg);
+
+      if (status < 0)
         {
-          // For compatibility with Matlab, we return true when the
-          // directory already exists.
-
           retval(2) = "mkdir";
-          retval(1) = "directory exists";
-          retval(0) = true;
+          retval(1) = msg;
         }
       else
-        {
-          int status = octave_mkdir (dirname, 0777, msg);
-
-          if (status < 0)
-            {
-              retval(2) = "mkdir";
-              retval(1) = msg;
-            }
-          else
-            retval(0) = true;
-        }
+        retval(0) = true;
     }
-  else
-    print_usage ();
 
   return retval;
 }
@@ -304,54 +298,52 @@
 {
   octave_value_list retval;
 
+  int nargin = args.length ();
+
+  if (nargin < 1 || nargin > 2)
+    print_usage ();
+
   retval(2) = std::string ();
   retval(1) = std::string ();
   retval(0) = false;
 
-  int nargin = args.length ();
+  std::string dirname = args(0).xstring_value ("rmdir: DIR must be a string");
 
-  if (nargin == 1 || nargin == 2)
-    {
-      std::string dirname = args(0).xstring_value ("rmdir: DIR must be a string");
+  std::string fulldir = file_ops::tilde_expand (dirname);
+  int status = -1;
+  std::string msg;
 
-      std::string fulldir = file_ops::tilde_expand (dirname);
-      int status = -1;
-      std::string msg;
+  if (nargin == 2)
+    {
+      if (args(1).string_value () == "s")
+        {
+          bool doit = true;
 
-      if (nargin == 2)
-        {
-          if (args(1).string_value () == "s")
+          if (interactive && ! forced_interactive
+              && Vconfirm_recursive_rmdir)
             {
-              bool doit = true;
-
-              if (interactive && ! forced_interactive
-                  && Vconfirm_recursive_rmdir)
-                {
-                  std::string prompt
-                    = "remove entire contents of " + fulldir + "? ";
+              std::string prompt
+                = "remove entire contents of " + fulldir + "? ";
 
-                  doit = octave_yes_or_no (prompt);
-                }
+              doit = octave_yes_or_no (prompt);
+            }
 
-              if (doit)
-                status = octave_recursive_rmdir (fulldir, msg);
-            }
-          else
-            error ("rmdir: second argument must be \"s\" for recursive removal");
+          if (doit)
+            status = octave_recursive_rmdir (fulldir, msg);
         }
       else
-        status = octave_rmdir (fulldir, msg);
-
-      if (status < 0)
-        {
-          retval(2) = "rmdir";
-          retval(1) = msg;
-        }
-      else
-        retval(0) = true;
+        error ("rmdir: second argument must be \"s\" for recursive removal");
     }
   else
-    print_usage ();
+    status = octave_rmdir (fulldir, msg);
+
+  if (status < 0)
+    {
+      retval(2) = "rmdir";
+      retval(1) = msg;
+    }
+  else
+    retval(0) = true;
 
   return retval;
 }
@@ -370,25 +362,23 @@
 {
   octave_value_list retval;
 
+  if (args.length () != 2)
+    print_usage ();
+
   retval(1) = std::string ();
   retval(0) = -1.0;
 
-  if (args.length () == 2)
-    {
-      std::string from = args(0).xstring_value ("link: OLD must be a string");
-      std::string to = args(1).xstring_value ("link: NEW must be a string");
+  std::string from = args(0).xstring_value ("link: OLD must be a string");
+  std::string to = args(1).xstring_value ("link: NEW must be a string");
 
-      std::string msg;
+  std::string msg;
 
-      int status = octave_link (from, to, msg);
-
-      if (status < 0)
-        retval(1) = msg;
+  int status = octave_link (from, to, msg);
 
-      retval(0) = status;
-    }
-  else
-    print_usage ();
+  if (status < 0)
+    retval(1) = msg;
+
+  retval(0) = status;
 
   return retval;
 }
@@ -407,25 +397,23 @@
 {
   octave_value_list retval;
 
+  if (args.length () != 2)
+    print_usage ();
+
   retval(1) = std::string ();
   retval(0) = -1.0;
 
-  if (args.length () == 2)
-    {
-      std::string from = args(0).xstring_value ("symlink: OLD must be a string");
-      std::string to = args(1).xstring_value ("symlink: NEW must be a string");
+  std::string from = args(0).xstring_value ("symlink: OLD must be a string");
+  std::string to = args(1).xstring_value ("symlink: NEW must be a string");
 
-      std::string msg;
+  std::string msg;
 
-      int status = octave_symlink (from, to, msg);
-
-      if (status < 0)
-        retval(1) = msg;
+  int status = octave_symlink (from, to, msg);
 
-      retval(0) = status;
-    }
-  else
-    print_usage ();
+  if (status < 0)
+    retval(1) = msg;
+
+  retval(0) = status;
 
   return retval;
 }
@@ -445,27 +433,25 @@
 {
   octave_value_list retval;
 
+  if (args.length () != 1)
+    print_usage ();
+
   retval(2) = std::string ();
   retval(1) = -1.0;
   retval(0) = std::string ();
 
-  if (args.length () == 1)
-    {
-      std::string symlink = args(0).xstring_value ("readlink: SYMLINK must be a string");
+  std::string symlink = args(0).xstring_value ("readlink: SYMLINK must be a string");
 
-      std::string result;
-      std::string msg;
-
-      int status = octave_readlink (symlink, result, msg);
+  std::string result;
+  std::string msg;
 
-      if (status < 0)
-        retval(2) = msg;
+  int status = octave_readlink (symlink, result, msg);
 
-      retval(1) = status;
-      retval(0) = result;
-    }
-  else
-    print_usage ();
+  if (status < 0)
+    retval(2) = msg;
+
+  retval(1) = status;
+  retval(0) = result;
 
   return retval;
 }
@@ -484,25 +470,23 @@
 {
   octave_value_list retval;
 
+  if (args.length () != 2)
+    print_usage ();
+
   retval(1) = std::string ();
   retval(0) = -1.0;
 
-  if (args.length () == 2)
-    {
-      std::string from = args(0).xstring_value ("rename: OLD must be a string");
-      std::string to = args(1).xstring_value ("rename: NEW must be a string");
+  std::string from = args(0).xstring_value ("rename: OLD must be a string");
+  std::string to = args(1).xstring_value ("rename: NEW must be a string");
 
-      std::string msg;
+  std::string msg;
 
-      int status = octave_rename (from, to, msg);
-
-      if (status < 0)
-        retval(1) = msg;
+  int status = octave_rename (from, to, msg);
 
-      retval(0) = status;
-    }
-  else
-    print_usage ();
+  if (status < 0)
+    retval(1) = msg;
+
+  retval(0) = status;
 
   return retval;
 }
@@ -558,20 +542,14 @@
 @seealso{ls, dir, readdir, what}\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  if (args.length () == 1)
-    {
-      string_vector pat = args(0).xall_strings ("glob: PATTERN must be a string");
-
-      glob_match pattern (file_ops::tilde_expand (pat));
-
-      retval = Cell (pattern.glob ());
-    }
-  else
+  if (args.length () != 1)
     print_usage ();
 
-  return retval;
+  string_vector pat = args(0).xall_strings ("glob: PATTERN must be a string");
+
+  glob_match pattern (file_ops::tilde_expand (pat));
+
+  return octave_value (Cell (pattern.glob ()));
 }
 
 /*
@@ -625,19 +603,15 @@
 {
   octave_value retval;
 
-  if (args.length () == 2)
-    {
-      string_vector pat = args(0).all_strings ();
-      string_vector str = args(1).all_strings ();
-
-      glob_match pattern (file_ops::tilde_expand (pat));
-
-      retval = pattern.match (str);
-    }
-  else
+  if (args.length () != 2)
     print_usage ();
 
-  return retval;
+  string_vector pat = args(0).all_strings ();
+  string_vector str = args(1).all_strings ();
+
+  glob_match pattern (file_ops::tilde_expand (pat));
+
+  return octave_value (pattern.match (str));
 }
 
 DEFUN (filesep, args, ,
@@ -655,9 +629,13 @@
 {
   octave_value retval;
 
-  if (args.length () == 0)
+  int nargin = args.length ();
+  if (nargin > 1)
+    print_usage ();
+
+  if (nargin == 0)
     retval = file_ops::dir_sep_str ();
-  else if (args.length () == 1)
+  else
     {
       std::string s = args(0).xstring_value ("filesep: argument must be a string");
       if (s == "all")
@@ -665,8 +643,6 @@
       else
         error ("filesep: argument must be \"all\"");
     }
-  else
-    print_usage ();
 
   return retval;
 }
@@ -683,6 +659,9 @@
 
   int nargin = args.length ();
 
+  if (nargin > 1)
+    print_usage ();
+
   if (nargout > 0 || nargin == 0)
     retval = dir_path::path_sep_str ();
 
@@ -705,8 +684,6 @@
           break;
         }
     }
-  else if (nargin > 1)
-    print_usage ();
 
   return retval;
 }
--- a/libinterp/corefcn/strfns.cc	Fri Dec 04 14:06:41 2015 -0500
+++ b/libinterp/corefcn/strfns.cc	Fri Dec 04 13:16:59 2015 -0500
@@ -289,16 +289,10 @@
 @seealso{isfloat, isinteger, islogical, isnumeric, iscellstr, isa}\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  int nargin = args.length ();
-
-  if (nargin == 1 && args(0).is_defined ())
-    retval = args(0).is_string ();
-  else
+  if (args.length () != 1)
     print_usage ();
 
-  return retval;
+  return octave_value (args(0).is_string ());
 }
 
 /*
@@ -561,17 +555,11 @@
 @seealso{strcmpi, strncmp, strncmpi}\n\
 @end deftypefn")
 {
-  octave_value retval;
-
-  if (args.length () == 2)
-    {
-      retval = do_strcmp_fun (args(0), args(1), 0,
-                              "strcmp", strcmp_array_op, strcmp_str_op);
-    }
-  else
+  if (args.length () != 2)
     print_usage ();
 
-  return retval;
+  return octave_value (do_strcmp_fun (args(0), args(1), 0, "strcmp",
+                                      strcmp_array_op, strcmp_str_op));
 }
 
 /*
@@ -679,20 +667,16 @@
 {
   octave_value retval;
 
-  if (args.length () == 3)
-    {
-      octave_idx_type n = args(2).idx_type_value ();
+  if (args.length () != 3)
+    print_usage ();
+
+  octave_idx_type n = args(2).idx_type_value ();
 
-      if (n > 0)
-        {
-          retval = do_strcmp_fun (args(0), args(1), n, "strncmp",
-                                  strncmp_array_op, strncmp_str_op);
-        }
-      else
-        error ("strncmp: N must be greater than 0");
-    }
+  if (n > 0)
+    retval = do_strcmp_fun (args(0), args(1), n, "strncmp",
+                            strncmp_array_op, strncmp_str_op);
   else
-    print_usage ();
+    error ("strncmp: N must be greater than 0");
 
   return retval;
 }
@@ -714,7 +698,9 @@
 struct icmp_char_eq : public std::binary_function<char, char, bool>
 {
   bool operator () (char x, char y) const
-  { return std::toupper (x) == std::toupper (y); }
+  {
+    return std::toupper (x) == std::toupper (y);
+  }
 };
 
 // strcmpi is equivalent to strcmp in that it checks all dims.
@@ -758,15 +744,11 @@
 {
   octave_value retval;
 
-  if (args.length () == 2)
-    {
-      retval = do_strcmp_fun (args(0), args(1), 0,
-                              "strcmpi", strcmpi_array_op, strcmpi_str_op);
-    }
-  else
+  if (args.length () != 2)
     print_usage ();
 
-  return retval;
+  return octave_value (do_strcmp_fun (args(0), args(1), 0, "strcmpi",
+                                      strcmpi_array_op, strcmpi_str_op));
 }
 
 /*
@@ -819,20 +801,16 @@
 {
   octave_value retval;
 
-  if (args.length () == 3)
-    {
-      octave_idx_type n = args(2).idx_type_value ();
+  if (args.length () != 3)
+    print_usage ();
+
+  octave_idx_type n = args(2).idx_type_value ();
 
-      if (n > 0)
-        {
-          retval = do_strcmp_fun (args(0), args(1), n, "strncmpi",
-                                  strncmpi_array_op, strncmpi_str_op);
-        }
-      else
-        error ("strncmpi: N must be greater than 0");
-    }
+  if (n > 0)
+    retval = do_strcmp_fun (args(0), args(1), n, "strncmpi",
+                            strncmpi_array_op, strncmpi_str_op);
   else
-    print_usage ();
+    error ("strncmpi: N must be greater than 0");
 
   return retval;
 }
@@ -882,10 +860,7 @@
   int nargin = args.length ();
 
   if (nargin < 1 || nargin > 3)
-    {
-      print_usage ();
-      return retval;
-    }
+    print_usage ();
 
   string_vector s = args(0).xall_strings ("list_in_columns: ARG must be a cellstr or char array");