changeset 19886:e9a0bd0b125c

Rename 'matlab-incompatible' warning to 'language-extension'. * libinterp/corefcn/error.cc: replace the 'matlab-incompatible' warning with 'language-extension'. This wording will hopefully make it clear that it does not stop or prevent Matlab code from running correctly in Octave, it simply warns about usage of Octave only features. * libinterp/parse-tree/lex.h, libinterp/parse-tree/lex.ll: throw the new 'language-extension' warning ID. Also, adjust function names to better reflect the warning name. * libinterp/corefcn/gripes.cc, libinterp/octave-value/ov-struct.cc, liboctave/numeric/bsxfun.h: use the new 'language-extension' warning ID. * scripts/miscellaneous/warning_ids.m: fix warning ID and reword text. * doc/interpreter/basics.txi, doc/interpreter/container.txi, scripts/miscellaneous/setfield.m: replace warning ID on documentation. * NEWS: make note of the change.
author Carnë Draug <carandraug@octave.org>
date Mon, 23 Feb 2015 20:43:54 +0000
parents 059a05bc398c
children 6645488466c7
files NEWS doc/interpreter/basics.txi doc/interpreter/container.txi libinterp/corefcn/error.cc libinterp/corefcn/gripes.cc libinterp/octave-value/ov-struct.cc libinterp/parse-tree/lex.h libinterp/parse-tree/lex.ll liboctave/numeric/bsxfun.h scripts/miscellaneous/setfield.m scripts/miscellaneous/warning_ids.m
diffstat 11 files changed, 52 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Sat Feb 21 16:38:53 2015 +0000
+++ b/NEWS	Mon Feb 23 20:43:54 2015 +0000
@@ -268,8 +268,11 @@
  ** The warning ID Octave:singular-matrix-div has been replaced by
     Octave:nearly-singular-matrix and Octave:singular-matrix.
 
+ ** The warning ID Octave:matlab-incompatible has been replaced by
+    Octave:language-extension to better reflect its meaning.
+
  ** The warning ID Octave:broadcast has been removed.  Instead automatic
-    broadcasting will throw an Octave:matlab-incompatible warning, together
+    broadcasting will throw an Octave:language-extension warning, together
     with other features not available in Matlab.
 
  ** The configure option --enable-octave-allocator has been removed.
--- a/doc/interpreter/basics.txi	Sat Feb 21 16:38:53 2015 +0000
+++ b/doc/interpreter/basics.txi	Mon Feb 23 20:43:54 2015 +0000
@@ -273,7 +273,7 @@
 @end example
 
 @noindent
-Note that this does not enable the @code{Octave:matlab-incompatible}
+Note that this does not enable the @code{Octave:language-extension}
 warning, which you might want if you want to be told about writing code
 that works in Octave but not @sc{matlab} (@pxref{XREFwarning,,warning},
 @ref{XREFwarning_ids,,warning_ids}).
--- a/doc/interpreter/container.txi	Sat Feb 21 16:38:53 2015 +0000
+++ b/doc/interpreter/container.txi	Mon Feb 23 20:43:54 2015 +0000
@@ -409,7 +409,7 @@
 @end example
 
 @noindent
-The warning id @code{Octave:matlab-incompatible} can be enabled to warn
+The warning id @code{Octave:language-extension} can be enabled to warn
 about this usage.  @xref{XREFwarning_ids,,warning_ids}.
 
 More realistically, all of the functions that operate on strings can be used
--- a/libinterp/corefcn/error.cc	Sat Feb 21 16:38:53 2015 +0000
+++ b/libinterp/corefcn/error.cc	Mon Feb 23 20:43:54 2015 +0000
@@ -1515,7 +1515,7 @@
                   // Since internal Octave functions are not
                   // compatible, turning all warnings into errors
                   // should leave the state of
-                  // Octave:matlab-incompatible alone.
+                  // Octave:language-extension alone.
 
                   if (arg1 == "error"
                       && warning_options.contains ("identifier"))
@@ -1533,7 +1533,7 @@
                             {
                               std::string key = vid.string_value ();
 
-                              if (key == "Octave:matlab-incompatible"
+                              if (key == "Octave:language-extension"
                                   || key == "Octave:single-quote-string")
                                 {
                                   id.resize (dim_vector (1, n+1));
@@ -1733,7 +1733,7 @@
   disable_warning ("Octave:array-to-scalar");
   disable_warning ("Octave:array-to-vector");
   disable_warning ("Octave:imag-to-real");
-  disable_warning ("Octave:matlab-incompatible");
+  disable_warning ("Octave:language-extension");
   disable_warning ("Octave:missing-semicolon");
   disable_warning ("Octave:neg-dim-as-zero");
   disable_warning ("Octave:resize-on-range-error");
--- a/libinterp/corefcn/gripes.cc	Sat Feb 21 16:38:53 2015 +0000
+++ b/libinterp/corefcn/gripes.cc	Mon Feb 23 20:43:54 2015 +0000
@@ -234,8 +234,8 @@
 void
 gripe_warn_complex_cmp (void)
 {
-  warning_with_id ("Octave:matlab-incompatible",
-                   "potential Matlab compatibility problem: comparing complex numbers");
+  warning_with_id ("Octave:language-extension",
+                   "comparing complex numbers is not supported in Matlab");
 }
 
 void
--- a/libinterp/octave-value/ov-struct.cc	Sat Feb 21 16:38:53 2015 +0000
+++ b/libinterp/octave-value/ov-struct.cc	Mon Feb 23 20:43:54 2015 +0000
@@ -122,11 +122,11 @@
   if (! valid_identifier (key))
     {
       if (who)
-        warning_with_id ("Octave:matlab-incompatible",
+        warning_with_id ("Octave:language-extension",
                          "%s: invalid structure field name '%s'",
                          who, key.c_str ());
       else
-        warning_with_id ("Octave:matlab-incompatible",
+        warning_with_id ("Octave:language-extension",
                          "invalid structure field name '%s'",
                          key.c_str ());
     }
--- a/libinterp/parse-tree/lex.h	Sat Feb 21 16:38:53 2015 +0000
+++ b/libinterp/parse-tree/lex.h	Mon Feb 23 20:43:54 2015 +0000
@@ -608,13 +608,13 @@
 
   void gripe_single_quote_string (void);
 
-  void gripe_matlab_incompatible (const std::string& msg);
+  void gripe_language_extension (const std::string& msg);
 
-  void maybe_gripe_matlab_incompatible_comment (char c);
+  void maybe_gripe_language_extension_comment (char c);
 
-  void gripe_matlab_incompatible_continuation (void);
+  void gripe_language_extension_continuation (void);
 
-  void gripe_matlab_incompatible_operator (const std::string& op);
+  void gripe_language_extension_operator (const std::string& op);
 
   void push_token (token *);
 
@@ -663,17 +663,18 @@
 
   int handle_op (const char *pattern, int tok, bool bos = false);
 
-  int handle_incompatible_op (const char *pattern, int tok, bool bos = false);
+  int handle_language_extension_op (const char *pattern, int tok,
+                                    bool bos = false);
 
   bool maybe_unput_comma_before_unary_op (int tok);
 
   int handle_unary_op (int tok, bool bos = false);
 
-  int handle_incompatible_unary_op (int tok, bool bos = false);
+  int handle_language_extension_unary_op (int tok, bool bos = false);
 
   int handle_assign_op (const char *pattern, int tok);
 
-  int handle_incompatible_assign_op (const char *pattern, int tok);
+  int handle_language_extension_assign_op (const char *pattern, int tok);
 
   int handle_op_internal (int tok, bool bos, bool compat);
 
--- a/libinterp/parse-tree/lex.ll	Sat Feb 21 16:38:53 2015 +0000
+++ b/libinterp/parse-tree/lex.ll	Mon Feb 23 20:43:54 2015 +0000
@@ -181,7 +181,8 @@
         } \
       else \
         { \
-          return curr_lexer->handle_incompatible_op (PATTERN, TOK, false); \
+          return curr_lexer->handle_language_extension_op (PATTERN, TOK, \
+                                                           false); \
         } \
     } \
   while (0)
@@ -209,7 +210,7 @@
           int tok \
             = (COMPAT \
                ? curr_lexer->handle_unary_op (TOK) \
-               : curr_lexer->handle_incompatible_unary_op (TOK)); \
+               : curr_lexer->handle_language_extension_unary_op (TOK)); \
  \
           if (tok < 0) \
             { \
@@ -506,7 +507,7 @@
     curr_lexer->current_input_column = 1;
 
     if (curr_lexer->nesting_level.is_paren ())
-      curr_lexer->gripe_matlab_incompatible ("bare newline inside parentheses");
+      curr_lexer->gripe_language_extension ("bare newline inside parentheses");
     else
       {
         int tok = curr_lexer->previous_token_value ();
@@ -1319,7 +1320,7 @@
     if (curr_lexer->nesting_level.is_paren ())
       {
         curr_lexer->at_beginning_of_statement = false;
-        curr_lexer->gripe_matlab_incompatible
+        curr_lexer->gripe_language_extension
           ("bare newline inside parentheses");
       }
     else if (curr_lexer->nesting_level.none ()
@@ -2713,7 +2714,7 @@
 
   int offset = 1;
   if (yytxt[0] == '\\')
-    gripe_matlab_incompatible_continuation ();
+    gripe_language_extension_continuation ();
   else
     offset = 3;
 
@@ -3023,41 +3024,41 @@
 }
 
 void
-octave_base_lexer::gripe_matlab_incompatible (const std::string& msg)
+octave_base_lexer::gripe_language_extension (const std::string& msg)
 {
   std::string nm = fcn_file_full_name;
 
   if (nm.empty ())
-    warning_with_id ("Octave:matlab-incompatible",
-                     "potential Matlab compatibility problem: %s",
+    warning_with_id ("Octave:language-extension",
+                     "Octave language extension used: %s",
                      msg.c_str ());
   else
-    warning_with_id ("Octave:matlab-incompatible",
-                     "potential Matlab compatibility problem: %s near line %d offile %s",
+    warning_with_id ("Octave:language-extension",
+                     "Octave language extension used: %s near line %d offile %s",
                      msg.c_str (), input_line_number, nm.c_str ());
 }
 
 void
-octave_base_lexer::maybe_gripe_matlab_incompatible_comment (char c)
+octave_base_lexer::maybe_gripe_language_extension_comment (char c)
 {
   if (c == '#')
-    gripe_matlab_incompatible ("# used as comment character");
+    gripe_language_extension ("# used as comment character");
 }
 
 void
-octave_base_lexer::gripe_matlab_incompatible_continuation (void)
+octave_base_lexer::gripe_language_extension_continuation (void)
 {
-  gripe_matlab_incompatible ("\\ used as line continuation marker");
+  gripe_language_extension ("\\ used as line continuation marker");
 }
 
 void
-octave_base_lexer::gripe_matlab_incompatible_operator (const std::string& op)
+octave_base_lexer::gripe_language_extension_operator (const std::string& op)
 {
   std::string t = op;
   int n = t.length ();
   if (t[n-1] == '\n')
     t.resize (n-1);
-  gripe_matlab_incompatible (t + " used as operator");
+  gripe_language_extension (t + " used as operator");
 }
 
 void
@@ -3318,8 +3319,8 @@
 }
 
 int
-octave_base_lexer::handle_incompatible_op (const char *pattern, int tok,
-                                           bool bos)
+octave_base_lexer::handle_language_extension_op (const char *pattern, int tok,
+                                                 bool bos)
 {
   lexer_debug (pattern);
 
@@ -3357,7 +3358,7 @@
 }
 
 int
-octave_base_lexer::handle_incompatible_unary_op (int tok, bool bos)
+octave_base_lexer::handle_language_extension_unary_op (int tok, bool bos)
 {
   return maybe_unput_comma_before_unary_op (tok)
     ? -1 : handle_op_internal (tok, bos, false);
@@ -3367,7 +3368,7 @@
 octave_base_lexer::handle_op_internal (int tok, bool bos, bool compat)
 {
   if (! compat)
-    gripe_matlab_incompatible_operator (flex_yytext ());
+    gripe_language_extension_operator (flex_yytext ());
 
   push_token (new token (tok, input_line_number, current_input_column));
 
--- a/liboctave/numeric/bsxfun.h	Sat Feb 21 16:38:53 2015 +0000
+++ b/liboctave/numeric/bsxfun.h	Mon Feb 23 20:43:54 2015 +0000
@@ -46,8 +46,7 @@
     }
 
   (*current_liboctave_warning_with_id_handler)
-    ("Octave:matlab-incompatible",
-     "Matlab compatibility problem - %s automatic broadcasting",
+    ("Octave:language-extension", "performing `%s' automatic broadcasting",
      name.c_str ());
 
   return true;
@@ -77,8 +76,7 @@
     }
 
   (*current_liboctave_warning_with_id_handler)
-    ("Octave:matlab-incompatible",
-     "Matlab compatibility problem - %s automatic broadcasting",
+    ("Octave:language-extension", "performing `%s' automatic broadcasting",
      name.c_str ());
 
   return true;
--- a/scripts/miscellaneous/setfield.m	Sat Feb 21 16:38:53 2015 +0000
+++ b/scripts/miscellaneous/setfield.m	Mon Feb 23 20:43:54 2015 +0000
@@ -45,7 +45,7 @@
 ## used here, as the field name is not a valid Octave identifier because of
 ## the space character.  Using arbitrary strings for field names is
 ## incompatible with @sc{matlab}, and this usage will emit a warning if the
-## warning ID @code{Octave:matlab-incompatible} is enabled.
+## warning ID @code{Octave:language-extension} is enabled.
 ## @xref{XREFwarning_ids}.
 ##
 ## With the second calling form, set a field of a structure array.  The
--- a/scripts/miscellaneous/warning_ids.m	Sat Feb 21 16:38:53 2015 +0000
+++ b/scripts/miscellaneous/warning_ids.m	Mon Feb 23 20:43:54 2015 +0000
@@ -161,19 +161,19 @@
 ## printed for implicit conversions of complex numbers to real numbers.
 ## By default, the @code{Octave:imag-to-real} warning is disabled.
 ##
+## @item Octave:language-extension
+## Print warnings when using features that are unique to the Octave
+## language and may be still be missing in @sc{Matlab}.
+## By default, the @code{Octave:language-extension} warning is disabled.
+## The --traditional or --braindead startup options for Octave may also
+## be of use, @pxref{Command Line Options}.
+##
 ## @item Octave:load-file-in-path
 ## By default, the @code{Octave:load-file-in-path} warning is enabled.
 ##
 ## @item Octave:logical-conversion
 ## By default, the @code{Octave:logical-conversion} warning is enabled.
 ##
-## @item Octave:matlab-incompatible
-## Print warnings for Octave language features that may cause
-## compatibility problems with @sc{matlab}.
-## By default, the @code{Octave:matlab-incompatible} warning is disabled.
-## The --traditional or --braindead startup options for Octave may also
-## be of use, @pxref{Command Line Options}.
-##
 ## @item Octave:md5sum-file-in-path
 ## By default, the @code{Octave:md5sum-file-in-path} warning is enabled.
 ##