changeset 30145:cd6f7957c889

* oct-parse.yy (OCTAVE_YYUSE): Use variadic macro.
author John W. Eaton <jwe@octave.org>
date Thu, 09 Sep 2021 13:36:50 -0400
parents 3c2dee80b542
children 1955fc6e2128
files libinterp/parse-tree/oct-parse.yy
diffstat 1 files changed, 36 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy	Thu Sep 09 13:27:49 2021 -0400
+++ b/libinterp/parse-tree/oct-parse.yy	Thu Sep 09 13:36:50 2021 -0400
@@ -99,7 +99,7 @@
 // need to do is mention the symantic value somewhere in the rule.  It
 // doesn't actually need to be used to avoid the Bison warning, so just
 // define this macro to discard its parameter.
-#define OCTAVE_YYUSE(X)
+#define OCTAVE_YYUSE(X, ...)
 
 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
    // Disable this warning for code that is generated by Bison,
@@ -622,8 +622,7 @@
                   }
                 | ',' arg_list ','
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     $$ = $2;
                   }
@@ -651,8 +650,7 @@
                   }
                 | '@' param_list anon_fcn_begin error
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($2);
+                    OCTAVE_YYUSE ($1, $2);
 
                     lexer.m_parsing_anon_fcn_body = false;
 
@@ -681,8 +679,7 @@
                   { $$ = $1; }
                 | '(' expression ')'
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     $$ = $2->mark_in_parens ();
                   }
@@ -743,8 +740,7 @@
                   { $$ = parser.make_postfix_op (MINUS_MINUS, $1, $2); }
                 | oper_expr '(' ')'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($2, $3);
 
                     $$ = parser.make_index_expression ($1, nullptr, '(');
                     if (! $$)
@@ -755,8 +751,7 @@
                   }
                 | oper_expr '(' arg_list ')'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($4);
+                    OCTAVE_YYUSE ($2, $4);
 
                     $$ = parser.make_index_expression ($1, $3, '(');
                     if (! $$)
@@ -767,8 +762,7 @@
                   }
                 | oper_expr '{' '}'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($2, $3);
 
                     $$ = parser.make_index_expression ($1, nullptr, '{');
                     if (! $$)
@@ -779,8 +773,7 @@
                   }
                 | oper_expr '{' arg_list '}'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($4);
+                    OCTAVE_YYUSE ($2, $4);
 
                     $$ = parser.make_index_expression ($1, $3, '{');
                     if (! $$)
@@ -797,8 +790,7 @@
                   { $$ = parser.make_indirect_ref ($1, $3->text ()); }
                 | oper_expr indirect_ref_op '(' expression ')'
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
+                    OCTAVE_YYUSE ($3, $5);
 
                     $$ = parser.make_indirect_ref ($1, $4);
                   }
@@ -846,8 +838,7 @@
                   { $$ = parser.make_postfix_op (MINUS_MINUS, $1, $2); }
                 | power_expr '(' ')'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($2, $3);
 
                     $$ = parser.make_index_expression ($1, nullptr, '(');
                     if (! $$)
@@ -858,8 +849,7 @@
                   }
                 | power_expr '(' arg_list ')'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($4);
+                    OCTAVE_YYUSE ($2, $4);
 
                     $$ = parser.make_index_expression ($1, $3, '(');
                     if (! $$)
@@ -870,8 +860,7 @@
                   }
                 | power_expr '{' '}'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($2, $3);
 
                     $$ = parser.make_index_expression ($1, nullptr, '{');
                     if (! $$)
@@ -882,8 +871,7 @@
                   }
                 | power_expr '{' arg_list '}'
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($4);
+                    OCTAVE_YYUSE ($2, $4);
 
                     $$ = parser.make_index_expression ($1, $3, '{');
                     if (! $$)
@@ -896,8 +884,7 @@
                   { $$ = parser.make_indirect_ref ($1, $3->text ()); }
                 | power_expr indirect_ref_op '(' expression ')'
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
+                    OCTAVE_YYUSE ($3, $5);
 
                     $$ = parser.make_indirect_ref ($1, $4);
                   }
@@ -927,8 +914,7 @@
                   }
                 | oper_expr ':' oper_expr ':' oper_expr
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($4);
+                    OCTAVE_YYUSE ($2, $4);
 
                     $$ = parser.make_colon_expression ($1, $5, $3);
 
@@ -1128,8 +1114,7 @@
 
 elseif_clause   : ELSEIF stash_comment opt_sep expression stmt_begin opt_sep opt_list
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($6);
+                    OCTAVE_YYUSE ($3, $6);
 
                     $4->mark_braindead_shortcircuit ();
 
@@ -1179,8 +1164,7 @@
 
 switch_case     : CASE stash_comment opt_sep expression stmt_begin opt_sep opt_list
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($6);
+                    OCTAVE_YYUSE ($3, $6);
 
                     $$ = parser.make_switch_case ($1, $4, $7, $2);
                   }
@@ -1212,15 +1196,13 @@
                   }
                 | DO stash_comment opt_sep opt_list UNTIL expression
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     $$ = parser.make_do_until_command ($5, $4, $6, $2);
                   }
                 | FOR stash_comment assign_lhs '=' expression stmt_begin opt_sep opt_list END
                   {
-                    OCTAVE_YYUSE ($4);
-                    OCTAVE_YYUSE ($7);
+                    OCTAVE_YYUSE ($4, $7);
 
                     if (! ($$ = parser.make_for_command (FOR, $1, $3, $5,
                                                          nullptr, $8, $9, $2)))
@@ -1231,10 +1213,7 @@
                   }
                 | FOR stash_comment '(' assign_lhs '=' expression ')' opt_sep opt_list END
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
-                    OCTAVE_YYUSE ($7);
-                    OCTAVE_YYUSE ($8);
+                    OCTAVE_YYUSE ($3, $5, $7, $8);
 
                     if (! ($$ = parser.make_for_command (FOR, $1, $4, $6,
                                                          nullptr, $9, $10, $2)))
@@ -1245,8 +1224,7 @@
                   }
                 | PARFOR stash_comment assign_lhs '=' expression stmt_begin opt_sep opt_list END
                   {
-                    OCTAVE_YYUSE ($4);
-                    OCTAVE_YYUSE ($7);
+                    OCTAVE_YYUSE ($4, $7);
 
                     if (! ($$ = parser.make_for_command (PARFOR, $1, $3, $5,
                                                          nullptr, $8, $9, $2)))
@@ -1257,11 +1235,7 @@
                   }
                 | PARFOR stash_comment '(' assign_lhs '=' expression ',' expression ')' opt_sep opt_list END
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
-                    OCTAVE_YYUSE ($7);
-                    OCTAVE_YYUSE ($9);
-                    OCTAVE_YYUSE ($10);
+                    OCTAVE_YYUSE ($3, $5, $7, $9, $10);
 
                     if (! ($$ = parser.make_for_command (PARFOR, $1, $4, $6,
                                                          $8, $11, $12, $2)))
@@ -1316,9 +1290,7 @@
 except_command  : UNWIND stash_comment opt_sep opt_list CLEANUP
                   stash_comment opt_sep opt_list END
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
-                    OCTAVE_YYUSE ($7);
+                    OCTAVE_YYUSE ($3, $5, $7);
 
                     if (! ($$ = parser.make_unwind_command ($1, $4, $8, $9, $2, $6)))
                       {
@@ -1329,9 +1301,7 @@
                 | TRY stash_comment opt_sep opt_list CATCH stash_comment
                   opt_sep opt_list END
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
-                    OCTAVE_YYUSE ($7);
+                    OCTAVE_YYUSE ($3, $5, $7);
 
                     if (! ($$ = parser.make_try_command ($1, $4, $7, $8, $9, $2, $6)))
                       {
@@ -1460,8 +1430,7 @@
 
 return_list     : '[' ']'
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($2);
+                    OCTAVE_YYUSE ($1, $2);
 
                     lexer.m_looking_at_return_list = false;
 
@@ -1488,8 +1457,7 @@
                   }
                 | '[' return_list1 ']'
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     lexer.m_looking_at_return_list = false;
 
@@ -1577,9 +1545,7 @@
                   }
                 | begin_file opt_nl classdef parsing_local_fcns opt_sep opt_fcn_list END_OF_INPUT
                   {
-                    OCTAVE_YYUSE ($2);
-                    OCTAVE_YYUSE ($5);
-                    OCTAVE_YYUSE ($7);
+                    OCTAVE_YYUSE ($2, $5, $7);
 
                     // Unused symbol table context.
                     lexer.m_symtab_context.pop ();
@@ -1616,8 +1582,7 @@
                   }
                 | GET '.' identifier
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($2);
+                    OCTAVE_YYUSE ($1, $2);
 
                     $$ = $3;
 
@@ -1628,8 +1593,7 @@
                   }
                 | SET '.' identifier
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($2);
+                    OCTAVE_YYUSE ($1, $2);
 
                     $$ = $3;
 
@@ -1698,8 +1662,7 @@
                 | function_beg stash_comment return_list '=' fcn_name
                   opt_param_list opt_sep function_body function_end
                   {
-                    OCTAVE_YYUSE ($4);
-                    OCTAVE_YYUSE ($7);
+                    OCTAVE_YYUSE ($4, $7);
 
                     $$ = parser.make_function ($1, $3, $5, $6, $8, $9, $2);
                   }
@@ -1744,8 +1707,7 @@
 arguments_block : arguments_beg stash_comment opt_sep args_attr_list
                   args_validation_list opt_sep END
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($6);
+                    OCTAVE_YYUSE ($3, $6);
 
                     octave::comment_list *lc = $2;
                     octave::comment_list *tc = lexer.get_comment ();
@@ -1771,8 +1733,7 @@
                   { $$ = nullptr; }
                 | '(' identifier ')'
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     // Error if $$ is nullptr.
                     if  (! ($$ = parser.make_args_attribute_list ($2)))
@@ -1820,8 +1781,7 @@
                   { $$ = nullptr; }
                 | '(' arg_list ')'
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     if (! ($$ = parser.make_arg_size_spec ($2)))
                       {
@@ -1842,8 +1802,7 @@
                   { $$ = nullptr; }
                 | '{' arg_list '}'
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
+                    OCTAVE_YYUSE ($1, $3);
 
                     if (! ($$ = parser.make_arg_validation_fcns ($2)))
                       {
@@ -1908,9 +1867,7 @@
                   { $$ = nullptr; }
                 | '(' attr_list1 ')' opt_sep
                   {
-                    OCTAVE_YYUSE ($1);
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($4);
+                    OCTAVE_YYUSE ($1, $3, $4);
 
                     $$ = $2;
                   }
@@ -2290,8 +2247,7 @@
 
 class_enum      : stash_comment identifier '(' expression ')'
                   {
-                    OCTAVE_YYUSE ($3);
-                    OCTAVE_YYUSE ($5);
+                    OCTAVE_YYUSE ($3, $5);
 
                     $$ = parser.make_classdef_enum ($2, $4, $1);
                   }