diff src/error.cc @ 10605:1834132fb50b

allow non-integer ranges as indices conditionally
author John W. Eaton <jwe@octave.org>
date Wed, 05 May 2010 14:20:58 -0400
parents cc69a17ec801
children 2b041d3995a3
line wrap: on
line diff
--- a/src/error.cc
+++ b/src/error.cc
@@ -1440,15 +1440,27 @@
   return retval;
 }
 
-void
-disable_warning (const std::string& id)
+octave_value_list
+set_warning_state (const std::string& id, const std::string& state)
 {
   octave_value_list args;
 
   args(1) = id;
-  args(0) = "off";
+  args(0) = state;
+
+  return Fwarning (args, 1);
+}
 
-  Fwarning (args, 0);
+octave_value_list
+set_warning_state (const octave_value_list& args)
+{
+  return Fwarning (args, 1);
+}
+
+void
+disable_warning (const std::string& id)
+{
+  set_warning_state (id, "off");
 }
 
 void
@@ -1473,6 +1485,10 @@
   disable_warning ("Octave:string-concat");
   disable_warning ("Octave:variable-switch-label");
   disable_warning ("Octave:complex-cmp-ops");
+
+  // This should be an error unless we are in maximum braindamage mode.
+
+  set_warning_state ("Octave:allow-noninteger-ranges-as-indices", "error");
 }
 
 DEFUN (lasterror, args, ,