diff libinterp/corefcn/mxarray.in.h @ 21151:bfd5e48c41a1

Rename local error in mex I/F from invalid_type_error to err_invalid_type. Switch from using class method mxArray_base::error to error from error.h * mex.cc (mxArray_base::error, mxArray_matlab::invalid_type_error): Delete functions. * mex.cc (mxArray_matlab::err_invalid_type): New function declared with OCTAVE_NORETURN. * mex.cc: #include "error.h". Rename all invalid_type_error calls to err_invalid_type. Remove useless statements appearing after calls to err_invalid_type. * mxarray.in.h: #include "error.h". Rename all invalid_type_error calls to err_invalid_type. * mxarray.in.h (mxArray_base::err_invalid_type): New function declared with OCTAVE_NORETURN. * mxarray.in.h (mxArray_base::invalid_type_error): Add OCTAVE_DEPRECATED attribute to function.
author Rik <rik@octave.org>
date Fri, 29 Jan 2016 11:32:23 -0800
parents 258c787cd9ce
children bae38398f5f1
line wrap: on
line diff
--- a/libinterp/corefcn/mxarray.in.h	Fri Jan 29 12:25:39 2016 -0500
+++ b/libinterp/corefcn/mxarray.in.h	Fri Jan 29 11:32:23 2016 -0800
@@ -93,6 +93,7 @@
 #if ! defined (MXARRAY_TYPEDEFS_ONLY)
 
 #include <cstring>
+#include "error.h"
 
 class octave_value;
 
@@ -116,10 +117,10 @@
       rep->METHOD_CALL; \
     }
 
-// A class to provide the default implemenation of some of the virtual
-// functions declared in the mxArray class.
+class mxArray;
 
-class mxArray;
+// A class to provide the default implementation of some of the
+// virtual functions declared in the mxArray class.
 
 class mxArray_base
 {
@@ -216,10 +217,11 @@
 
   virtual void set_class_name (const char *name_arg) = 0;
 
+  // FIXME: Why not just have this '= 0' as the others?
+  // Could then eliminate err_invalid_type function and #include "error.h".
   virtual mxArray *get_cell (mwIndex /*idx*/) const
   {
-    invalid_type_error ();
-    return 0;
+    err_invalid_type ();
   }
 
   virtual void set_cell (mwIndex idx, mxArray *val) = 0;
@@ -279,12 +281,17 @@
 
   mxArray_base (const mxArray_base&) { }
 
+  // FIXME: Deprecated in 4.2, remove in 4.6
+  OCTAVE_DEPRECATED ("use 'err_invalid_type' instead")
   void invalid_type_error (void) const
   {
     error ("invalid type for operation");
   }
 
-  void error (const char *msg) const;
+  OCTAVE_NORETURN void err_invalid_type (void) const
+  {
+    error ("invalid type for operation");
+  }
 };
 
 // The main interface class.  The representation can be based on an