diff libinterp/corefcn/dasrt.cc @ 20957:9db35d2042be

maint: eliminate special cases of statements after error. * daspk.cc: Eliminate DASPK_ABORT, DASPK_ABORT1, DASPK_ABORT2 macros. * dasrt.cc: Eliminate DASRT_ABORT, DASRT_ABORT1, DASRT_ABORT2 macros. * dassl.cc: Eliminate DASSL_ABORT, DASSL_ABORT1, DASSL_ABORT2 macros. libinterp/corefcn/graphics.cc (Fdrawnow): Reverse order and call gh_manager::unlock() before call to error(). * variables.cc (Fmlock): Adjust indentation. * __glpk__.cc (glpk): Add FIXME note about unreachable code. * __init_fltk__.cc (F__fltk_check__, F__init_fltk__): Place return statement within #ifdef HAVE_FLTK block. * ov-fcn-handle.cc (load_hdf5): eliminate useless statements after error. * ov-java.cc (F__java_exit__): Place return statement within #ifdef HAVE_JAVA block. * octave.cc (octave_process_command_line): Issue warning, which will return, and then call octave_print_terse_usage_and_exit. * lex.ll: Add FIXME notes about unreachable code. * oct-parse.in.yy (source_file): Eliminate useless return after error.
author Rik <rik@octave.org>
date Sun, 20 Dec 2015 15:31:53 -0800
parents 48b2ad5ee801
children 1edf15793cac
line wrap: on
line diff
--- a/libinterp/corefcn/dasrt.cc	Sun Dec 20 13:26:17 2015 -0800
+++ b/libinterp/corefcn/dasrt.cc	Sun Dec 20 15:31:53 2015 -0800
@@ -196,25 +196,6 @@
   return retval;
 }
 
-#define DASRT_ABORT \
-  return retval
-
-#define DASRT_ABORT1(msg) \
-  do \
-    { \
-      error ("dasrt: " msg); \
-      DASRT_ABORT; \
-    } \
-  while (0)
-
-#define DASRT_ABORT2(fmt, arg) \
-  do \
-    { \
-      error ("dasrt: " fmt, arg); \
-      DASRT_ABORT; \
-    } \
-  while (0)
-
 DEFUN (dasrt, args, nargout,
        "-*- texinfo -*-\n\
 @deftypefn  {} {[@var{x}, @var{xdot}, @var{t_out}, @var{istat}, @var{msg}] =} dasrt (@var{fcn}, [], @var{x_0}, @var{xdot_0}, @var{t})\n\
@@ -373,7 +354,7 @@
   call_depth++;
 
   if (call_depth > 1)
-    DASRT_ABORT1 ("invalid recursive call");
+    error ("dasrt: invalid recursive call");
 
   int argp = 0;
   std::string fcn_name, fname, jac_name, jname;
@@ -429,7 +410,7 @@
             }
         }
       else
-        DASRT_ABORT1 ("incorrect number of elements in cell array");
+        error ("dasrt: incorrect number of elements in cell array");
     }
 
   if (! dasrt_f && ! f_arg.is_cell ())
@@ -476,14 +457,13 @@
               break;
 
             default:
-              DASRT_ABORT1
-                ("first arg should be a string or 2-element string array");
+              error ("dasrt: first arg should be a string or 2-element string array");
             }
         }
     }
 
   if (! dasrt_f)
-    DASRT_ABORT;
+    return retval;
 
   DAERTFunc func (dasrt_user_f);
 
@@ -494,7 +474,7 @@
       dasrt_cf = args(1).function_value ();
 
       if (! dasrt_cf)
-        DASRT_ABORT1 ("invalid constraint function G");
+        error ("dasrt: invalid constraint function G");
 
       argp++;
 
@@ -504,7 +484,7 @@
     {
       dasrt_cf = is_valid_function (args(1), "dasrt", true);
       if (! dasrt_cf)
-        DASRT_ABORT1 ("invalid constraint function G");
+        error ("dasrt: invalid constraint function G");
 
       argp++;