}
}
-/** 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;
}
# 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 <tt>warnings_flag & warnings_error</tt>. This is exported
+ error if <tt>warnings_flag & Werror</tt>. 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. */
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
&& muscle_find_const (name))
{
- muscle_percent_define_how how_old =
- atoi (muscle_find_const (how_name));
+ muscle_percent_define_how how_old = atoi (muscle_find_const (how_name));
+ unsigned i = 0;
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);
}
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
{
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;
}
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"));
}
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);
}
/*--------------------------------------------------.
]])
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
]])
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
]])
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
]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
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': <type2> != <type1>
- glr-regr18.y:25.18-24: previous declaration
- glr-regr18.y:27.13-19: result type clash on merge function 'merge': <type3> != <type2>
- glr-regr18.y:26.18-24: previous declaration
- ])
-[glr-regr18.y:26.18-24: error: result type clash on merge function 'merge': <type2> != <type1>
++[[glr-regr18.y:26.18-24: error: result type clash on merge function 'merge': <type2> != <type1>
+ glr-regr18.y:25.18-24: previous declaration
+ glr-regr18.y:27.13-19: error: result type clash on merge function 'merge': <type3> != <type2>
+ glr-regr18.y:26.18-24: previous declaration
-])
++]])
AT_CLEANUP
]])
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: <bar> != <>
-input.y:6.6-8: warning: type clash on default action: <bar> != <>
-input.y:7.5: warning: empty rule for typed nonterminal, and no action
+input.y:5.6-32: warning: type clash on default action: <bar> != <> [-Wother]
+input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
+input.y:7.5: warning: empty rule for typed nonterminal, and no action [-Wother]
]])
AT_CLEANUP
]])
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
AT_CLEANUP
- [[input.y:2.16-18: symbol bar is used, but is not defined as a token and has no rules
+## ------------------- ##
+## Undefined symbols. ##
+## ------------------- ##
+
+AT_SETUP([Undefined symbols])
+
+AT_DATA([[input.y]],
+[[%printer {} foo baz
+%destructor {} bar
+%type <foo> qux
+%%
+exp: bar;
+]])
+
+AT_BISON_CHECK([input.y], [1], [],
++[[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 <type1> tag1
+%type <type2> tag2
+
+%printer { } <type1> <type3>
+%destructor { } <type2> <type4>
+
+%%
+
+exp: tag1 { $1; }
+ | tag2 { $1; }
+
+tag2: "a" { $$; }
+]])
+
+AT_BISON_CHECK([input.y], [0], [],
+[[input.y:4.22-28: warning: type <type3> is used, but is not associated to any symbol [-Wother]
+input.y:5.25-31: warning: type <type4> 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 <type1> token1
+%token <type2> token2
+%token <type3> token3
+%token <type4> token4
+%token <type5> token51 token52
+%token <type6> token61 token62
+%token <type7> token7
+
+%printer {} token1
+%destructor {} token2
+%printer {} token51
+%destructor {} token61
+
+%printer {} token7
+
+%printer {} <type1>
+%destructor {} <type2>
+%printer {} <type3>
+%destructor {} <type4>
+
+%printer {} <type5>
+%destructor {} <type6>
+
+%destructor {} <type7>
+
+%%
+exp: "a";]],
+[[input.y:16.13-19: warning: useless %printer for type <type1> [-Wother]
+input.y:17.16-22: warning: useless %destructor for type <type2> [-Wother]]])
+
+# If everybody is typed, <> is useless.
+AT_TEST([[%type <type> exp
+%token <type> 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. ##
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]],
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]],
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[
]])])
])
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],
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],
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
|| 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
]])
AT_BISON_CHECK([-o test.c test.y], 1, [],
- [[test.y:50.51-60: invalid reference: '$<ival>lo9'
+ [[test.y:50.51-60: error: invalid reference: '$<ival>lo9'
test.y:50.3-68: symbol not found in production: lo9
-test.y:51.51-60: warning: misleading reference: '$<ival>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: '$<ival>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
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
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])
]])
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
]])