changeset 22223:cf18d6e791a1

Prevent Octave:language-extension from becoming an error (bug #44336). * error.cc (Fwarning): Explicitly set Octave:language-extension=off when setting warning ("error", "all").
author Lachlan Andrew <lachlanbis@gmail.com>
date Thu, 11 Feb 2016 21:06:45 +1100
parents 8a50ab960ae6
children 20e0c0b8820c
files libinterp/corefcn/error.cc
diffstat 1 files changed, 12 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/error.cc	Mon Aug 08 20:46:12 2016 +0100
+++ b/libinterp/corefcn/error.cc	Thu Feb 11 21:06:45 2016 +1100
@@ -1562,45 +1562,26 @@
               // If "all" is explicitly given as ID.
 
               octave_map tmp;
+              int is_error = (arg1 == "error");
 
-              Cell id (1, 1);
-              Cell st (1, 1);
+              Cell id (1, 1 + 2*is_error);
+              Cell st (1, 1 + 2*is_error);
 
               id(0) = arg2;
               st(0) = arg1;
 
               // Since internal Octave functions are not compatible,
-              // turning all warnings into errors should leave the state of
-              // Octave:language-extension alone.
-
-              if (arg1 == "error" && warning_options.contains ("identifier"))
-                {
-                  octave_idx_type n = 1;
-
-                  Cell tid = warning_options.contents ("identifier");
-                  Cell tst = warning_options.contents ("state");
-
-                  for (octave_idx_type i = 0; i < tid.numel (); i++)
-                    {
-                      octave_value vid = tid(i);
+              // and "all"=="error" causes any "on" to throw an error,
+              // turning all warnings into errors should disable
+              // Octave:language-extension.
 
-                      if (vid.is_string ())
-                        {
-                          std::string key = vid.string_value ();
+              if (is_error)
+                {
+                  id(1) = "Octave:language-extension";
+                  st(1) = "off";
 
-                          if (key == "Octave:language-extension"
-                              || key == "Octave:single-quote-string")
-                            {
-                              id.resize (dim_vector (1, n+1));
-                              st.resize (dim_vector (1, n+1));
-
-                              id(n) = tid(i);
-                              st(n) = tst(i);
-
-                              n++;
-                            }
-                        }
-                    }
+                  id(2) = "Octave:single-quote-string";
+                  st(2) = "off";
                 }
 
               tmp.assign ("identifier", id);