mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
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
This commit is contained in:
@@ -122,7 +122,9 @@ complains (const location *loc, warnings flags, const char *message,
|
||||
{
|
||||
if (flags & complaint)
|
||||
{
|
||||
error_message (loc, complaint, NULL, message, args);
|
||||
error_message (loc, complaint,
|
||||
indent_ptr && *indent_ptr ? NULL : _("error"),
|
||||
message, args);
|
||||
complaint_issued = true;
|
||||
}
|
||||
else if (flags & fatal)
|
||||
@@ -140,13 +142,17 @@ complains (const location *loc, warnings flags, const char *message,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,6 +185,7 @@ void complain_at_indent (location loc, warnings flags, unsigned *indent,
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
|
||||
/*--------------------------------.
|
||||
| Report a warning, and proceed. |
|
||||
`--------------------------------*/
|
||||
|
||||
@@ -48,6 +48,9 @@ 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 & Werror</tt>. This is exported
|
||||
only for the sake of Yacc-compatible conflict reports in conflicts.c.
|
||||
|
||||
@@ -326,13 +326,14 @@ Warning categories include:\n\
|
||||
`yacc' incompatibilities with POSIX Yacc\n\
|
||||
`conflicts-sr' S/R conflicts (enabled by default)\n\
|
||||
`conflicts-rr' R/R conflicts (enabled by default)\n\
|
||||
`deprecated' obsolete constructs\n\
|
||||
`other' all other warnings (enabled by default)\n\
|
||||
`all' all the warnings\n\
|
||||
`no-CATEGORY' turn off warnings in CATEGORY\n\
|
||||
`none' turn off all the warnings\n\
|
||||
`error' treat warnings as errors\n\
|
||||
\n\
|
||||
"), stdout);
|
||||
putc ('\n', stdout);
|
||||
|
||||
fputs (_("\
|
||||
THINGS is a list of comma separated words that can include:\n\
|
||||
|
||||
@@ -439,12 +439,16 @@ muscle_percent_define_insert (char const *variable, location variable_loc,
|
||||
&& muscle_find_const (name))
|
||||
{
|
||||
muscle_percent_define_how how_old = atoi (muscle_find_const (how_name));
|
||||
unsigned i = 0;
|
||||
if (how_old == MUSCLE_PERCENT_DEFINE_F)
|
||||
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),
|
||||
complaint, &i,
|
||||
_("previous definition"));
|
||||
}
|
||||
|
||||
MUSCLE_INSERT_STRING (name, value);
|
||||
@@ -600,13 +604,16 @@ muscle_percent_define_check_values (char const * const *values)
|
||||
}
|
||||
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, 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, complaint, &i, _("accepted value: %s"),
|
||||
quote (*values));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
15
src/reader.c
15
src/reader.c
@@ -128,11 +128,16 @@ record_merge_function_type (int merger, uniqstr type, location declaration_loc)
|
||||
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, 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, complaint,
|
||||
&indent,
|
||||
_("previous declaration"));
|
||||
}
|
||||
merge_function->type = uniqstr_new (type);
|
||||
merge_function->type_declaration_location = declaration_loc;
|
||||
|
||||
28
src/symtab.c
28
src/symtab.c
@@ -193,16 +193,24 @@ static void
|
||||
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, complaint, &i,
|
||||
_("%s redeclaration for %s"), what, s->tag);
|
||||
i += SUB_INDENT;
|
||||
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, complaint, &i,
|
||||
_("%s redeclaration for <%s>"), what, s->tag);
|
||||
i += SUB_INDENT;
|
||||
complain_at_indent (first, complaint, &i,
|
||||
_("previous declaration"));
|
||||
}
|
||||
|
||||
|
||||
@@ -546,6 +554,7 @@ symbol_pack_processor (void *this, void *null ATTRIBUTE_UNUSED)
|
||||
static void
|
||||
user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
||||
{
|
||||
unsigned i = 0;
|
||||
/* User token numbers are not assigned during the parsing, but in a
|
||||
second step, via a traversal of the symbol table sorted on tag.
|
||||
|
||||
@@ -557,11 +566,12 @@ user_token_number_redeclaration (int num, symbol *first, symbol *second)
|
||||
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, complaint, &i,
|
||||
_("user token number %d redeclaration for %s"),
|
||||
num, second->tag);
|
||||
complain_at_indent (first->location, complaint, &i,
|
||||
_("previous declaration for %s"),
|
||||
first->tag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------.
|
||||
|
||||
Reference in New Issue
Block a user