From: Akim Demaille Date: Wed, 26 Sep 2012 12:35:47 +0000 (+0200) Subject: Merge branch 'maint' X-Git-Tag: v2.7.90~323 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/11b192127cac086338bfaa43f3bab3acda8e3a20 Merge branch 'maint' * maint: warnings: introduce -Wdeprecated in the usage info errors: prefix the output with "error: " errors: indent "invalid value for %define" context errors: indent "%define var" redefinition context errors: indent "symbol redeclaration" context errors: indent "result type clash" error context Conflicts: src/complain.c src/muscle-tab.c src/reader.c src/symtab.c tests/conflicts.at tests/input.at tests/named-refs.at tests/output.at tests/skeletons.at --- 11b192127cac086338bfaa43f3bab3acda8e3a20 diff --cc src/complain.c index d79a2502,b063c6b6..1834120d --- a/src/complain.c +++ b/src/complain.c @@@ -113,84 -81,133 +113,91 @@@ error_message (const location *loc, war } } -/** Wrap error_message() with varargs handling. */ -#define ERROR_MESSAGE(Loc, Prefix, Message) \ -{ \ - va_list args; \ - va_start (args, Message); \ - error_message (Loc, Prefix, Message, args); \ - va_end (args); \ -} - - -/*--------------------------------. -| Report a warning, and proceed. | -`--------------------------------*/ +/** Raise a complaint. That can be a fatal error, a complaint or just a + warning. */ -void -set_warning_issued (void) +static inline void +complains (const location *loc, warnings flags, const char *message, + va_list args) { - static bool warning_issued = false; - if (!warning_issued && (warnings_flag & warnings_error)) + if (flags & complaint) { - error_message (loc, complaint, NULL, message, args); - fprintf (stderr, "%s: warnings being treated as errors\n", program_name); ++ error_message (loc, complaint, ++ indent_ptr && *indent_ptr ? NULL : _("error"), ++ message, args); complaint_issued = true; } - warning_issued = true; -} - -void -warn_at (location loc, const char *message, ...) -{ - if (!(warnings_flag & warnings_other)) - return; - set_warning_issued (); - ERROR_MESSAGE (&loc, _("warning"), message); -} - -void -warn_at_indent (location loc, unsigned *indent, - const char *message, ...) -{ - if (!(warnings_flag & warnings_other)) - return; - set_warning_issued (); - indent_ptr = indent; - ERROR_MESSAGE (&loc, *indent ? NULL : _("warning"), message); + else if (flags & fatal) + { + error_message (loc, fatal, _("fatal error"), message, args); + exit (EXIT_FAILURE); + } + else if (flags & Wyacc) + { + if (yacc_flag) + { + error_message (loc, flags, NULL, message, args); + complaint_issued = true; + } + else if (warnings_flag & Wyacc) + { + set_warning_issued (); - error_message (loc, flags, _("warning"), message, args); ++ error_message (loc, flags, ++ indent_ptr && *indent_ptr ? NULL : _("warning"), ++ message, args); + } + } + else if (warnings_flag & flags) + { + set_warning_issued (); - error_message (loc, flags, _("warning"), message, args); ++ error_message (loc, flags, ++ indent_ptr && *indent_ptr ? NULL : _("warning"), ++ message, args); + } } void -warn (const char *message, ...) +complain (warnings flags, const char *message, ...) { - if (!(warnings_flag & warnings_other)) - return; - set_warning_issued (); - ERROR_MESSAGE (NULL, _("warning"), message); + va_list args; + va_start (args, message); + complains (NULL, flags, message, args); + va_end (args); } - -/*-----------------------------------------------------------. -| An error has occurred, but we can proceed, and die later. | -`-----------------------------------------------------------*/ - void -complain_at (location loc, const char *message, ...) +complain_at (location loc, warnings flags, const char *message, ...) { - ERROR_MESSAGE (&loc, _("error"), message); - complaint_issued = true; + va_list args; + va_start (args, message); + complains (&loc, flags, message, args); + va_end (args); } -void -complain_at_indent (location loc, unsigned *indent, - const char *message, ...) +void complain_at_indent (location loc, warnings flags, unsigned *indent, + const char *message, ...) { indent_ptr = indent; - ERROR_MESSAGE (&loc, *indent ? NULL : _("error"), message); - complaint_issued = true; -} -void -complain (const char *message, ...) -{ - ERROR_MESSAGE (NULL, _("error"), message); - complaint_issued = true; + va_list args; + va_start (args, message); + complains (&loc, flags, message, args); + va_end (args); } + -/*--------------------------------------------------------------. -| An incompatibility with POSIX Yacc: mapped either to warn* or | -| complain* depending on yacc_flag. | -`--------------------------------------------------------------*/ +/*--------------------------------. +| Report a warning, and proceed. | +`--------------------------------*/ void -yacc_at (location loc, const char *message, ...) +set_warning_issued (void) { - if (yacc_flag) + static bool warning_issued = false; + if (!warning_issued && (warnings_flag & Werror)) { - ERROR_MESSAGE (&loc, NULL, message); + fprintf (stderr, "%s: warnings being treated as errors\n", program_name); complaint_issued = true; } - else if (warnings_flag & warnings_yacc) - { - set_warning_issued (); - ERROR_MESSAGE (&loc, _("warning"), message); - } -} - -void -midrule_value_at (location loc, const char *message, ...) -{ - if (!(warnings_flag & warnings_midrule_values)) - return; - set_warning_issued (); - ERROR_MESSAGE (&loc, _("warning"), message); -} - -/*-------------------------------------------------. -| A severe error has occurred, we cannot proceed. | -`-------------------------------------------------*/ - -void -fatal_at (location loc, const char *message, ...) -{ - ERROR_MESSAGE (&loc, _("fatal error"), message); - exit (EXIT_FAILURE); -} - -void -fatal (const char *message, ...) -{ - ERROR_MESSAGE (NULL, _("fatal error"), message); - exit (EXIT_FAILURE); + warning_issued = true; } diff --cc src/complain.h index 44be293d,997d577b..452508ef --- a/src/complain.h +++ b/src/complain.h @@@ -21,35 -21,15 +21,38 @@@ # include "location.h" -# ifdef __cplusplus -extern "C" { -# endif +/*-------------. +| --warnings. | +`-------------*/ + +typedef enum + { + Wnone = 0, /**< Issue no warnings. */ + Wmidrule_values = 1 << 0, /**< Unset or unused midrule values. */ + Wyacc = 1 << 1, /**< POSIXME. */ + Wconflicts_sr = 1 << 2, /**< S/R conflicts. */ + Wconflicts_rr = 1 << 3, /**< R/R conflicts. */ + Wdeprecated = 1 << 4, /**< Obsolete constructs. */ + Wother = 1 << 5, /**< All other warnings. */ + + Werror = 1 << 10, /**< Warnings are treated as errors. */ + complaint = 1 << 11, /**< All complaints. */ + fatal = 1 << 12, /**< All fatal errors. */ + silent = 1 << 13, /**< Do not display the warning type. */ + Wall = ~Werror /**< All above warnings. */ + } warnings; + +/** What warnings are issued. */ +extern warnings warnings_flag; + +/** Display a "[-Wyacc]" like message on stderr. */ +void warnings_print_categories (warnings warn_flags); + /* Sub-messages indent. */ + #define SUB_INDENT (4) + /** Record that a warning is about to be issued, and treat it as an - error if warnings_flag & warnings_error. This is exported + error if warnings_flag & Werror. This is exported only for the sake of Yacc-compatible conflict reports in conflicts.c. All other warnings should be implemented in complain.c and should use the normal warning format. */ diff --cc src/muscle-tab.c index 8e569812,37a0f0e8..4738fdfd --- a/src/muscle-tab.c +++ b/src/muscle-tab.c @@@ -438,13 -426,19 +438,17 @@@ muscle_percent_define_insert (char cons if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE && muscle_find_const (name)) { + muscle_percent_define_how how_old = atoi (muscle_find_const (how_name)); + unsigned i = 0; - muscle_percent_define_how how_old = - atoi (muscle_find_const (how_name)); if (how_old == MUSCLE_PERCENT_DEFINE_F) - { - free (variable_tr); - return; - } - complain_at_indent (variable_loc, &i, - _("%%define variable %s redefined"), quote (variable)); + return; - complain_at (variable_loc, complaint, _("%%define variable %s redefined"), - quote (variable)); - location loc = muscle_percent_define_get_loc (variable); - complain_at (loc, complaint, _("previous definition")); ++ complain_at_indent (variable_loc, complaint, &i, ++ _("%%define variable %s redefined"), ++ quote (variable)); + i += SUB_INDENT; - complain_at_indent (muscle_percent_define_get_loc (variable), &i, ++ complain_at_indent (muscle_percent_define_get_loc (variable), ++ complaint, &i, + _("previous definition")); } MUSCLE_INSERT_STRING (name, value); @@@ -600,13 -593,15 +604,16 @@@ muscle_percent_define_check_values (cha } if (!*values) { + unsigned i = 0; location loc = muscle_percent_define_get_loc (*variablep); - complain_at (loc, complaint, - _("invalid value for %%define variable %s: %s"), - quote (*variablep), quote_n (1, value)); - complain_at_indent (loc, &i, - _("invalid value for %%define variable %s: %s"), - quote (*variablep), quote_n (1, value)); ++ complain_at_indent ++ (loc, complaint, &i, ++ _("invalid value for %%define variable %s: %s"), ++ quote (*variablep), quote_n (1, value)); + i += SUB_INDENT; for (values = variablep + 1; *values; ++values) - complain_at (loc, complaint, _("accepted value: %s"), - quote (*values)); - complain_at_indent (loc, &i, _("accepted value: %s"), ++ complain_at_indent (loc, complaint, &i, _("accepted value: %s"), + quote (*values)); } else { diff --cc src/reader.c index 52c0b139,86fde7b2..f658e64e --- a/src/reader.c +++ b/src/reader.c @@@ -128,12 -128,16 +128,17 @@@ record_merge_function_type (int merger aver (merge_function != NULL && merger_find == merger); if (merge_function->type != NULL && !UNIQSTR_EQ (merge_function->type, type)) { - complain_at (declaration_loc, complaint, - _("result type clash on merge function %s: <%s> != <%s>"), - quote (merge_function->name), type, merge_function->type); - complain_at (merge_function->type_declaration_location, complaint, - _("previous declaration")); + unsigned indent = 0; - complain_at_indent (declaration_loc, &indent, ++ complain_at_indent (declaration_loc, complaint, &indent, + _("result type clash on merge function %s: " + "<%s> != <%s>"), + quote (merge_function->name), type, + merge_function->type); + indent += SUB_INDENT; - complain_at_indent (merge_function->type_declaration_location, &indent, ++ complain_at_indent (merge_function->type_declaration_location, complaint, ++ &indent, + _("previous declaration")); - } + } merge_function->type = uniqstr_new (type); merge_function->type_declaration_location = declaration_loc; } diff --cc src/symtab.c index 21c61255,2e0b9201..916536ae --- a/src/symtab.c +++ b/src/symtab.c @@@ -193,16 -150,20 +193,24 @@@ static voi symbol_redeclaration (symbol *s, const char *what, location first, location second) { - complain_at (second, complaint, _("%s redeclaration for %s"), what, s->tag); - complain_at (first, complaint, _("previous declaration")); + unsigned i = 0; - complain_at_indent (second, &i, _("%s redeclaration for %s"), what, s->tag); ++ complain_at_indent (second, complaint, &i, ++ _("%s redeclaration for %s"), what, s->tag); + i += SUB_INDENT; - complain_at_indent (first, &i, _("previous declaration")); ++ complain_at_indent (first, complaint, &i, ++ _("previous declaration")); } static void semantic_type_redeclaration (semantic_type *s, const char *what, location first, location second) { - complain_at (second, complaint, _("%s redeclaration for <%s>"), what, s->tag); - complain_at (first, complaint, _("previous declaration")); + unsigned i = 0; - complain_at_indent (second, &i, _("%s redeclaration for <%s>"), what, s->tag); ++ complain_at_indent (second, complaint, &i, ++ _("%s redeclaration for <%s>"), what, s->tag); + i += SUB_INDENT; - complain_at_indent (first, &i, _("previous declaration")); ++ complain_at_indent (first, complaint, &i, ++ _("previous declaration")); } @@@ -557,11 -531,12 +566,12 @@@ user_token_number_redeclaration (int nu first = second; second = tmp; } - complain_at (second->location, complaint, - _("user token number %d redeclaration for %s"), - num, second->tag); - complain_at (first->location, complaint, _("previous declaration for %s"), - first->tag); - complain_at_indent (second->location, &i, ++ complain_at_indent (second->location, complaint, &i, + _("user token number %d redeclaration for %s"), + num, second->tag); - complain_at_indent (first->location, &i, ++ complain_at_indent (first->location, complaint, &i, + _("previous declaration for %s"), + first->tag); } /*--------------------------------------------------. diff --cc tests/conflicts.at index 83ef1286,3934a6cf..b3f67098 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@@ -945,8 -895,9 +945,8 @@@ exp: exp OP exp | NUM ]]) AT_BISON_CHECK([-o input.c input.y], 1, [], - [[input.y: shift/reduce conflicts: 1 found, 0 expected -[input.y: conflicts: 1 shift/reduce -input.y: error: expected 0 shift/reduce conflicts -]) ++[[input.y: error: shift/reduce conflicts: 1 found, 0 expected +]]) AT_CLEANUP @@@ -981,8 -932,9 +981,8 @@@ exp: exp OP exp | NUM ]]) AT_BISON_CHECK([-o input.c input.y], 1, [], - [[input.y: shift/reduce conflicts: 1 found, 2 expected -[input.y: conflicts: 1 shift/reduce -input.y: error: expected 2 shift/reduce conflicts -]) ++[[input.y: error: shift/reduce conflicts: 1 found, 2 expected +]]) AT_CLEANUP @@@ -1000,8 -952,9 +1000,8 @@@ a: 'a' ]]) AT_BISON_CHECK([-o input.c input.y], 1, [], - [[input.y: reduce/reduce conflicts: 1 found, 0 expected -[input.y: conflicts: 1 reduce/reduce -input.y: error: expected 0 reduce/reduce conflicts -]) ++[[input.y: error: reduce/reduce conflicts: 1 found, 0 expected +]]) AT_CLEANUP @@@ -1580,18 -1491,15 +1580,18 @@@ for gram in sr-rr sr rr; d ]AT_BISON_CHECK([[-Wnone $file]])[ ]AT_BISON_CHECK([[-Werror $file]])[ else - echo "$file: conflicts: $conflicts" > experr - if test $sr_count -ne $sr_exp; then - if test $sr_exp -ne 1; then s=s; else s= ; fi - echo "$file: error: expected $sr_exp shift/reduce conflict$s" >> experr - fi - if test $rr_count -ne $rr_exp; then - if test $rr_exp -ne 1; then s=s; else s= ; fi - echo "$file: error: expected $rr_exp reduce/reduce conflict$s" >> experr - fi + { + if test -z "$sr_exp_i" && test "$sr_count" -ne 0; then + echo "warning: $sr_count shift/reduce conflicts" + elif test "$sr_exp_i" -ne "$sr_count"; then - echo "shift/reduce conflicts: $sr_count found, $sr_exp_i expected" ++ echo "error: shift/reduce conflicts: $sr_count found, $sr_exp_i expected" + fi + if test -z "$rr_exp_i" && test "$rr_count" -ne 0; then + echo "warning: $rr_count reduce/reduce conflicts" + elif test "$rr_exp_i" -ne "$rr_count"; then - echo "reduce/reduce conflicts: $rr_count found, $rr_exp_i expected" ++ echo "error: reduce/reduce conflicts: $rr_count found, $rr_exp_i expected" + fi + } | sed -e "s/^/$file: /" > experr ]AT_BISON_CHECK([[-Wnone $file]], [[1]], [[]], [[experr]])[ ]AT_BISON_CHECK([[-Werror $file]], [[1]], [[]], [[experr]])[ fi diff --cc tests/glr-regression.at index 98ebdfa6,aacc57c8..b376c1c0 --- a/tests/glr-regression.at +++ b/tests/glr-regression.at @@@ -1652,11 -1650,11 +1652,11 @@@ main (void AT_BISON_OPTION_POPDEFS AT_BISON_CHECK([[-o glr-regr18.c glr-regr18.y]], 1, [], - [glr-regr18.y:26.18-24: result type clash on merge function 'merge': != - glr-regr18.y:25.18-24: previous declaration - glr-regr18.y:27.13-19: result type clash on merge function 'merge': != - glr-regr18.y:26.18-24: previous declaration - ]) -[glr-regr18.y:26.18-24: error: result type clash on merge function 'merge': != ++[[glr-regr18.y:26.18-24: error: result type clash on merge function 'merge': != + glr-regr18.y:25.18-24: previous declaration + glr-regr18.y:27.13-19: error: result type clash on merge function 'merge': != + glr-regr18.y:26.18-24: previous declaration -]) ++]]) AT_CLEANUP diff --cc tests/input.at index 056e5785,50c10506..5bb707e7 --- a/tests/input.at +++ b/tests/input.at @@@ -58,11 -58,11 +58,11 @@@ exp: foo { $$; } foo { $2; } fo ]]) AT_BISON_CHECK([input.y], [1], [], - [[input.y:5.12-13: $$ for the midrule at $2 of 'exp' has no declared type - input.y:5.24-25: $2 of 'exp' has no declared type + [[input.y:5.12-13: error: $$ for the midrule at $2 of 'exp' has no declared type + input.y:5.24-25: error: $2 of 'exp' has no declared type -input.y:5.6-32: warning: type clash on default action: != <> -input.y:6.6-8: warning: type clash on default action: != <> -input.y:7.5: warning: empty rule for typed nonterminal, and no action +input.y:5.6-32: warning: type clash on default action: != <> [-Wother] +input.y:6.6-8: warning: type clash on default action: != <> [-Wother] +input.y:7.5: warning: empty rule for typed nonterminal, and no action [-Wother] ]]) AT_CLEANUP @@@ -200,30 -205,30 +200,30 @@@ start: ]]) AT_BISON_CHECK([input.y], [1], [], - [[input.y:1.13-29: %destructor redeclaration for <*> - input.y:1.13-29: previous declaration - input.y:2.10-24: %printer redeclaration for <*> - input.y:2.10-24: previous declaration - input.y:4.13-29: %destructor redeclaration for <*> - input.y:1.13-29: previous declaration - input.y:5.10-24: %printer redeclaration for <*> - input.y:2.10-24: previous declaration - input.y:7.13-29: %destructor redeclaration for <> - input.y:7.13-29: previous declaration - input.y:8.10-24: %printer redeclaration for <> - input.y:8.10-24: previous declaration - input.y:10.13-29: %destructor redeclaration for <> - input.y:7.13-29: previous declaration - input.y:11.10-24: %printer redeclaration for <> - input.y:8.10-24: previous declaration - input.y:17.13-29: %destructor redeclaration for <*> - input.y:4.13-29: previous declaration - input.y:18.10-24: %printer redeclaration for <*> - input.y:5.10-24: previous declaration - input.y:20.13-29: %destructor redeclaration for <> - input.y:10.13-29: previous declaration - input.y:21.10-24: %printer redeclaration for <> - input.y:11.10-24: previous declaration -[[input.y:1.13-29: error: redeclaration for default tagged %destructor ++[[input.y:1.13-29: error: %destructor redeclaration for <*> + input.y:1.13-29: previous declaration -input.y:2.10-24: error: redeclaration for default tagged %printer ++input.y:2.10-24: error: %printer redeclaration for <*> + input.y:2.10-24: previous declaration -input.y:4.13-29: error: redeclaration for default tagged %destructor ++input.y:4.13-29: error: %destructor redeclaration for <*> + input.y:1.13-29: previous declaration -input.y:5.10-24: error: redeclaration for default tagged %printer ++input.y:5.10-24: error: %printer redeclaration for <*> + input.y:2.10-24: previous declaration -input.y:7.13-29: error: redeclaration for default tagless %destructor ++input.y:7.13-29: error: %destructor redeclaration for <> + input.y:7.13-29: previous declaration -input.y:8.10-24: error: redeclaration for default tagless %printer ++input.y:8.10-24: error: %printer redeclaration for <> + input.y:8.10-24: previous declaration -input.y:10.13-29: error: redeclaration for default tagless %destructor ++input.y:10.13-29: error: %destructor redeclaration for <> + input.y:7.13-29: previous declaration -input.y:11.10-24: error: redeclaration for default tagless %printer ++input.y:11.10-24: error: %printer redeclaration for <> + input.y:8.10-24: previous declaration -input.y:17.13-29: error: redeclaration for default tagged %destructor ++input.y:17.13-29: error: %destructor redeclaration for <*> + input.y:4.13-29: previous declaration -input.y:18.10-24: error: redeclaration for default tagged %printer ++input.y:18.10-24: error: %printer redeclaration for <*> + input.y:5.10-24: previous declaration -input.y:20.13-29: error: redeclaration for default tagless %destructor ++input.y:20.13-29: error: %destructor redeclaration for <> + input.y:10.13-29: previous declaration -input.y:21.10-24: error: redeclaration for default tagless %printer ++input.y:21.10-24: error: %printer redeclaration for <> + input.y:11.10-24: previous declaration ]]) AT_CLEANUP @@@ -271,123 -276,6 +271,123 @@@ input.y:5.10-24: previous declarat AT_CLEANUP +## ------------------- ## +## Undefined symbols. ## +## ------------------- ## + +AT_SETUP([Undefined symbols]) + +AT_DATA([[input.y]], +[[%printer {} foo baz +%destructor {} bar +%type qux +%% +exp: bar; +]]) + +AT_BISON_CHECK([input.y], [1], [], - [[input.y:2.16-18: symbol bar is used, but is not defined as a token and has no rules ++[[input.y:2.16-18: error: symbol bar is used, but is not defined as a token and has no rules +input.y:1.17-19: warning: symbol baz is used, but is not defined as a token and has no rules [-Wother] +input.y:1.13-15: warning: symbol foo is used, but is not defined as a token and has no rules [-Wother] +input.y:3.13-15: warning: symbol qux is used, but is not defined as a token and has no rules [-Wother] +]]) + +AT_CLEANUP + + +## ----------------------------------------------------- ## +## Unassociated types used for a printer or destructor. ## +## ----------------------------------------------------- ## + +AT_SETUP([Unassociated types used for a printer or destructor]) + +AT_DATA([[input.y]], +[[%token tag1 +%type tag2 + +%printer { } +%destructor { } + +%% + +exp: tag1 { $1; } + | tag2 { $1; } + +tag2: "a" { $$; } +]]) + +AT_BISON_CHECK([input.y], [0], [], +[[input.y:4.22-28: warning: type is used, but is not associated to any symbol [-Wother] +input.y:5.25-31: warning: type is used, but is not associated to any symbol [-Wother] +]]) + +AT_CLEANUP + + +## --------------------------------- ## +## Useless printers or destructors. ## +## --------------------------------- ## + +AT_SETUP([Useless printers or destructors]) + +# AT_TEST([INPUT], [STDERR]) +# -------------------------- +m4_pushdef([AT_TEST], +[AT_DATA([[input.y]], +[$1 +]) +AT_BISON_CHECK([input.y], [0], [], [$2 +])]) + +AT_TEST([[%token token1 +%token token2 +%token token3 +%token token4 +%token token51 token52 +%token token61 token62 +%token token7 + +%printer {} token1 +%destructor {} token2 +%printer {} token51 +%destructor {} token61 + +%printer {} token7 + +%printer {} +%destructor {} +%printer {} +%destructor {} + +%printer {} +%destructor {} + +%destructor {} + +%% +exp: "a";]], +[[input.y:16.13-19: warning: useless %printer for type [-Wother] +input.y:17.16-22: warning: useless %destructor for type [-Wother]]]) + +# If everybody is typed, <> is useless. +AT_TEST([[%type exp +%token a +%printer {} <> <*> +%% +exp: a;]], +[[input.y:3.13-14: warning: useless %printer for type <> [-Wother]]]) + +# If nobody is typed, <*> is useless. +AT_TEST([[%token a +%printer {} <> <*> +%% +exp: a;]], +[[input.y:2.16-18: warning: useless %printer for type <*> [-Wother]]]) + +m4_popdef([AT_TEST]) + +AT_CLEANUP + ## ---------------------------------------- ## ## Unused values with default %destructor. ## @@@ -1180,11 -1069,10 +1181,11 @@@ AT_DATA([[input.y]] start: ; ]]) AT_BISON_CHECK([[input.y]], [1], [], -[[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither' +[[input.y:1.9-21: warning: deprecated %define variable name: 'api.push_pull', use 'api.push-pull' [-Wdeprecated] - input.y:1.9-21: invalid value for %define variable 'api.push-pull': 'neither' - input.y:1.9-21: accepted value: 'pull' - input.y:1.9-21: accepted value: 'push' - input.y:1.9-21: accepted value: 'both' ++input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither' + input.y:1.9-21: error: accepted value: 'pull' + input.y:1.9-21: error: accepted value: 'push' + input.y:1.9-21: error: accepted value: 'both' ]]) AT_DATA([[input.y]], @@@ -1193,20 -1081,7 +1194,20 @@@ start: ; ]]) AT_BISON_CHECK([[input.y]], [1], [], -[[input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-states' +[[input.y:1.9-34: warning: deprecated %define variable name: 'lr.keep_unreachable_states', use 'lr.keep-unreachable-states' [-Wdeprecated] - input.y:1.9-34: invalid value for %define Boolean variable 'lr.keep-unreachable-states' ++input.y:1.9-34: error: invalid value for %define Boolean variable 'lr.keep-unreachable-states' +]]) + +AT_DATA([[input.y]], +[[%define namespace "foo" +%define api.namespace "foo" +%% +start: ; +]]) +AT_BISON_CHECK([[input.y]], [1], [], +[[input.y:1.9-17: warning: deprecated %define variable name: 'namespace', use 'api.namespace' [-Wdeprecated] - input.y:2.9-21: %define variable 'api.namespace' redefined - input.y:1.9-17: previous definition ++input.y:2.9-21: error: %define variable 'api.namespace' redefined ++input.y:1.9-17: previous definition ]]) AT_DATA([[input.y]], @@@ -1274,7 -1149,7 +1275,7 @@@ start: AT_BISON_CHECK([[input.y]], [1], [], [m4_foreach([b4_arg], m4_dquote(m4_shift($@)), - [[input.y:3.9-21: ]b4_arg[ -[[input.y:3.9-17: error: ]b4_arg[ ++[[input.y:3.9-21: error: ]b4_arg[ ]])]) ]) @@@ -1323,11 -1198,11 +1324,11 @@@ start: AT_CHECK([[perl -e "print 'start: \'';" >> empty.y || exit 77]]) AT_BISON_CHECK([empty.y], [1], [], -[[empty.y:2.8-9: warning: empty character literal -empty.y:3.8-4.0: warning: empty character literal +[[empty.y:2.8-9: warning: empty character literal [-Wother] +empty.y:3.8-4.0: warning: empty character literal [-Wother] - empty.y:3.8-4.0: missing "'" at end of line + empty.y:3.8-4.0: error: missing "'" at end of line -empty.y:4.8: warning: empty character literal +empty.y:4.8: warning: empty character literal [-Wother] - empty.y:4.8: missing "'" at end of file + empty.y:4.8: error: missing "'" at end of file ]]) AT_DATA([two.y], @@@ -1338,11 -1213,11 +1339,11 @@@ start: 'a AT_CHECK([[perl -e "print 'start: \'ab';" >> two.y || exit 77]]) AT_BISON_CHECK([two.y], [1], [], -[[two.y:2.8-11: warning: extra characters in character literal -two.y:3.8-4.0: warning: extra characters in character literal +[[two.y:2.8-11: warning: extra characters in character literal [-Wother] +two.y:3.8-4.0: warning: extra characters in character literal [-Wother] - two.y:3.8-4.0: missing "'" at end of line + two.y:3.8-4.0: error: missing "'" at end of line -two.y:4.8-10: warning: extra characters in character literal +two.y:4.8-10: warning: extra characters in character literal [-Wother] - two.y:4.8-10: missing "'" at end of file + two.y:4.8-10: error: missing "'" at end of file ]]) AT_DATA([three.y], @@@ -1353,11 -1228,11 +1354,11 @@@ start: 'ab AT_CHECK([[perl -e "print 'start: \'abc';" >> three.y || exit 77]]) AT_BISON_CHECK([three.y], [1], [], -[[three.y:2.8-12: warning: extra characters in character literal -three.y:3.8-4.0: warning: extra characters in character literal +[[three.y:2.8-12: warning: extra characters in character literal [-Wother] +three.y:3.8-4.0: warning: extra characters in character literal [-Wother] - three.y:3.8-4.0: missing "'" at end of line + three.y:3.8-4.0: error: missing "'" at end of line -three.y:4.8-11: warning: extra characters in character literal +three.y:4.8-11: warning: extra characters in character literal [-Wother] - three.y:4.8-11: missing "'" at end of file + three.y:4.8-11: error: missing "'" at end of file ]]) AT_CLEANUP @@@ -1383,30 -1258,30 +1384,30 @@@ AT_CHECK([[perl -e 'print "start: \"\\\ || exit 77]]) AT_BISON_CHECK([input.y], [1], [], - [[input.y:2.9-12: invalid number after \-escape: 777 + [[input.y:2.9-12: error: invalid number after \-escape: 777 -input.y:2.8-13: warning: empty character literal +input.y:2.8-13: warning: empty character literal [-Wother] - input.y:2.16-17: invalid number after \-escape: 0 + input.y:2.16-17: error: invalid number after \-escape: 0 -input.y:2.15-18: warning: empty character literal +input.y:2.15-18: warning: empty character literal [-Wother] - input.y:2.21-25: invalid number after \-escape: xfff + input.y:2.21-25: error: invalid number after \-escape: xfff -input.y:2.20-26: warning: empty character literal +input.y:2.20-26: warning: empty character literal [-Wother] - input.y:2.29-31: invalid number after \-escape: x0 + input.y:2.29-31: error: invalid number after \-escape: x0 -input.y:2.28-32: warning: empty character literal +input.y:2.28-32: warning: empty character literal [-Wother] - input.y:3.9-14: invalid number after \-escape: uffff + input.y:3.9-14: error: invalid number after \-escape: uffff -input.y:3.8-15: warning: empty character literal +input.y:3.8-15: warning: empty character literal [-Wother] - input.y:3.18-23: invalid number after \-escape: u0000 + input.y:3.18-23: error: invalid number after \-escape: u0000 -input.y:3.17-24: warning: empty character literal +input.y:3.17-24: warning: empty character literal [-Wother] - input.y:3.27-36: invalid number after \-escape: Uffffffff + input.y:3.27-36: error: invalid number after \-escape: Uffffffff -input.y:3.26-37: warning: empty character literal +input.y:3.26-37: warning: empty character literal [-Wother] - input.y:3.40-49: invalid number after \-escape: U00000000 + input.y:3.40-49: error: invalid number after \-escape: U00000000 -input.y:3.39-50: warning: empty character literal +input.y:3.39-50: warning: empty character literal [-Wother] - input.y:4.9-10: invalid character after \-escape: ' ' + input.y:4.9-10: error: invalid character after \-escape: ' ' -input.y:4.8-11: warning: empty character literal +input.y:4.8-11: warning: empty character literal [-Wother] - input.y:4.14-15: invalid character after \-escape: A + input.y:4.14-15: error: invalid character after \-escape: A -input.y:4.13-16: warning: empty character literal +input.y:4.13-16: warning: empty character literal [-Wother] - input.y:5.9-16: invalid character after \-escape: \t - input.y:5.17: invalid character after \-escape: \f - input.y:5.18: invalid character after \-escape: \0 - input.y:5.19: invalid character after \-escape: \001 + input.y:5.9-16: error: invalid character after \-escape: \t + input.y:5.17: error: invalid character after \-escape: \f + input.y:5.18: error: invalid character after \-escape: \0 + input.y:5.19: error: invalid character after \-escape: \001 ]]) AT_CLEANUP diff --cc tests/named-refs.at index f9e48a57,d76e75f3..1cd55b31 --- a/tests/named-refs.at +++ b/tests/named-refs.at @@@ -251,16 -251,16 +251,16 @@@ exp ]]) AT_BISON_CHECK([-o test.c test.y], 1, [], - [[test.y:50.51-60: invalid reference: '$lo9' + [[test.y:50.51-60: error: invalid reference: '$lo9' test.y:50.3-68: symbol not found in production: lo9 -test.y:51.51-60: warning: misleading reference: '$exp' -test.y:42.1-3: refers to: $exp at $$ -test.y:51.7: possibly meant: $x, hiding $exp at $1 -test.y:51.41: possibly meant: $r, hiding $exp at $4 +test.y:51.51-60: warning: misleading reference: '$exp' [-Wother] - test.y:42.1-3: warning: refers to: $exp at $$ [-Wother] - test.y:51.7: warning: possibly meant: $x, hiding $exp at $1 [-Wother] - test.y:51.41: warning: possibly meant: $r, hiding $exp at $4 [-Wother] - test.y:52.51-52: $l of 'exp' has no declared type - test.y:55.46-49: invalid reference: '$r12' ++test.y:42.1-3: refers to: $exp at $$ [-Wother] ++test.y:51.7: possibly meant: $x, hiding $exp at $1 [-Wother] ++test.y:51.41: possibly meant: $r, hiding $exp at $4 [-Wother] + test.y:52.51-52: error: $l of 'exp' has no declared type + test.y:55.46-49: error: invalid reference: '$r12' test.y:55.3-53: symbol not found in production: r12 - test.y:56.29-33: invalid reference: '$expo' + test.y:56.29-33: error: invalid reference: '$expo' test.y:56.3-46: symbol not found in production: expo ]]) AT_BISON_OPTION_POPDEFS @@@ -277,9 -277,9 +277,9 @@@ foo: '1 foo.bar: '2' ]]) AT_BISON_CHECK([-o test.c test.y], 0, [], -[[test.y:11.22-29: warning: misleading reference: '$foo.bar' -test.y:11.8-10: refers to: $foo at $1 -test.y:11.12-18: possibly meant: $[foo.bar] at $2 +[[test.y:11.22-29: warning: misleading reference: '$foo.bar' [-Wother] - test.y:11.8-10: warning: refers to: $foo at $1 [-Wother] - test.y:11.12-18: warning: possibly meant: $[foo.bar] at $2 [-Wother] ++test.y:11.8-10: refers to: $foo at $1 [-Wother] ++test.y:11.12-18: possibly meant: $[foo.bar] at $2 [-Wother] ]]) AT_CLEANUP diff --cc tests/output.at index cce330e8,9f1bd115..3a13fd3e --- a/tests/output.at +++ b/tests/output.at @@@ -182,17 -162,17 +182,17 @@@ AT_CHECK_CONFLICTING_OUTPUT([foo.y] AT_CHECK_CONFLICTING_OUTPUT([foo.y], [%defines "foo.output"], [-v], -[foo.y: warning: conflicting outputs to file 'foo.output' -]) +[[foo.y: warning: conflicting outputs to file 'foo.output' [-Wother] +]]) AT_CHECK_CONFLICTING_OUTPUT([foo.y], -[%skeleton "lalr1.cc" %defines], [--graph="location.hh"], -[foo.y: warning: conflicting outputs to file 'location.hh' -]) +[%skeleton "lalr1.cc" %defines %locations], [--graph="location.hh"], +[[foo.y: warning: conflicting outputs to file 'location.hh' [-Wother] +]]) AT_CHECK_CONFLICTING_OUTPUT([foo.y], [], [-o foo.y], - [[foo.y: refusing to overwrite the input file 'foo.y' -[foo.y: error: refusing to overwrite the input file 'foo.y' -], 1) ++[[foo.y: error: refusing to overwrite the input file 'foo.y' +]], 1) # AT_CHECK_OUTPUT_FILE_NAME(FILE-NAME-PREFIX, [ADDITIONAL-TESTS]) diff --cc tests/skeletons.at index ce32e88b,ec8170ca..ce079d62 --- a/tests/skeletons.at +++ b/tests/skeletons.at @@@ -191,10 -191,10 +191,10 @@@ start: ]]) AT_BISON_CHECK([[input1.y]], [[1]], [[]], -[[input1.y: warning: foow fubar -foow.y:2.3-5.3: warning: foowat fubar +[[input1.y: warning: foow fubar [-Wother] +foow.y:2.3-5.3: warning: foowat fubar [-Wother] - input1.y: fooc fubar - fooc.y:1.1-10.5: foocat fubar + input1.y: error: fooc fubar + fooc.y:1.1-10.5: error: foocat fubar input1.y: fatal error: foof fubar ]])