mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 15:53:03 +00:00
warnings: fusion of complain and complain_at
These functions are very similar, and keeping them seperate makes future improvements difficult, so merge them. This impacts 89 calls. * src/bootstrap.conf: Adjust. * src/complain.c (complain, complain_at): Merge into... (complain): this. (complain_args): Adjust. * src/complain.h, src/conflicts.c, src/files.c, src/getargs.c, * src/gram.c, src/location.c, src/muscle-tab.c, src/parse-gram.y, * src/reader.c, src/reduce.c, src/scan-code.l, src/scan-gram.l, * src/scan-skel.l, src/symlist.c, src/symtab.c: Adjust. Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
committed by
Akim Demaille
parent
a49f4904c3
commit
bb8e56ff67
@@ -48,8 +48,7 @@ gnulib_modules='
|
|||||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||||
--from-code=UTF-8\\\
|
--from-code=UTF-8\\\
|
||||||
--flag=asprintf:2:c-format\\\
|
--flag=asprintf:2:c-format\\\
|
||||||
--flag=complain:2:c-format\\\
|
--flag=complain:3:c-format\\\
|
||||||
--flag=complain_at:3:c-format\\\
|
|
||||||
--flag=complain_at_indent:4:c-format\\\
|
--flag=complain_at_indent:4:c-format\\\
|
||||||
--flag=unexpected_end:2:c-format\\\
|
--flag=unexpected_end:2:c-format\\\
|
||||||
'
|
'
|
||||||
|
|||||||
@@ -143,29 +143,20 @@ complains (const location *loc, warnings flags, const char *message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
complain (warnings flags, const char *message, ...)
|
complain (location const* loc, warnings flags, const char *message, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, message);
|
va_start (args, message);
|
||||||
complains (NULL, flags, message, args);
|
complains (loc, flags, message, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
complain_at (location loc, warnings flags, const char *message, ...)
|
complain_at_indent (location loc, warnings flags, unsigned *indent,
|
||||||
|
const char *message, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start (args, message);
|
|
||||||
complains (&loc, flags, message, args);
|
|
||||||
va_end (args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void complain_at_indent (location loc, warnings flags, unsigned *indent,
|
|
||||||
const char *message, ...)
|
|
||||||
{
|
|
||||||
indent_ptr = indent;
|
indent_ptr = indent;
|
||||||
|
|
||||||
va_list args;
|
|
||||||
va_start (args, message);
|
va_start (args, message);
|
||||||
complains (&loc, flags, message, args);
|
complains (&loc, flags, message, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|||||||
@@ -57,12 +57,8 @@ extern warnings errors_flag;
|
|||||||
/** Display a "[-Wyacc]" like message on stderr. */
|
/** Display a "[-Wyacc]" like message on stderr. */
|
||||||
void warnings_print_categories (warnings warn_flags);
|
void warnings_print_categories (warnings warn_flags);
|
||||||
|
|
||||||
/** Make a complaint, but don't specify any location. */
|
/** Make a complaint, with maybe a location. */
|
||||||
void complain (warnings flags, char const *message, ...)
|
void complain (location const* loc, warnings flags, char const *message, ...)
|
||||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
|
||||||
|
|
||||||
/** Make a complaint with location. */
|
|
||||||
void complain_at (location loc, warnings flags, char const *message, ...)
|
|
||||||
__attribute__ ((__format__ (__printf__, 3, 4)));
|
__attribute__ ((__format__ (__printf__, 3, 4)));
|
||||||
|
|
||||||
/** Make a complaint with location and some indentation. */
|
/** Make a complaint with location and some indentation. */
|
||||||
|
|||||||
@@ -561,7 +561,7 @@ conflicts_print (void)
|
|||||||
{
|
{
|
||||||
if (! glr_parser && expected_rr_conflicts != -1)
|
if (! glr_parser && expected_rr_conflicts != -1)
|
||||||
{
|
{
|
||||||
complain (Wother, _("%%expect-rr applies only to GLR parsers"));
|
complain (NULL, Wother, _("%%expect-rr applies only to GLR parsers"));
|
||||||
expected_rr_conflicts = -1;
|
expected_rr_conflicts = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,12 +577,12 @@ conflicts_print (void)
|
|||||||
if (expected != -1)
|
if (expected != -1)
|
||||||
{
|
{
|
||||||
if (expected != total)
|
if (expected != total)
|
||||||
complain (complaint,
|
complain (NULL, complaint,
|
||||||
_("shift/reduce conflicts: %d found, %d expected"),
|
_("shift/reduce conflicts: %d found, %d expected"),
|
||||||
total, expected);
|
total, expected);
|
||||||
}
|
}
|
||||||
else if (total)
|
else if (total)
|
||||||
complain (Wconflicts_sr,
|
complain (NULL, Wconflicts_sr,
|
||||||
ngettext ("%d shift/reduce conflict",
|
ngettext ("%d shift/reduce conflict",
|
||||||
"%d shift/reduce conflicts",
|
"%d shift/reduce conflicts",
|
||||||
total),
|
total),
|
||||||
@@ -599,12 +599,12 @@ conflicts_print (void)
|
|||||||
if (expected != -1)
|
if (expected != -1)
|
||||||
{
|
{
|
||||||
if (expected != total)
|
if (expected != total)
|
||||||
complain (complaint,
|
complain (NULL, complaint,
|
||||||
_("reduce/reduce conflicts: %d found, %d expected"),
|
_("reduce/reduce conflicts: %d found, %d expected"),
|
||||||
total, expected);
|
total, expected);
|
||||||
}
|
}
|
||||||
else if (total)
|
else if (total)
|
||||||
complain (Wconflicts_rr,
|
complain (NULL, Wconflicts_rr,
|
||||||
ngettext ("%d reduce/reduce conflict",
|
ngettext ("%d reduce/reduce conflict",
|
||||||
"%d reduce/reduce conflicts",
|
"%d reduce/reduce conflicts",
|
||||||
total),
|
total),
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ output_file_name_check (char **file_name)
|
|||||||
bool conflict = false;
|
bool conflict = false;
|
||||||
if (STREQ (*file_name, grammar_file))
|
if (STREQ (*file_name, grammar_file))
|
||||||
{
|
{
|
||||||
complain (complaint, _("refusing to overwrite the input file %s"),
|
complain (NULL, complaint, _("refusing to overwrite the input file %s"),
|
||||||
quote (*file_name));
|
quote (*file_name));
|
||||||
conflict = true;
|
conflict = true;
|
||||||
}
|
}
|
||||||
@@ -370,7 +370,7 @@ output_file_name_check (char **file_name)
|
|||||||
for (i = 0; i < file_names_count; i++)
|
for (i = 0; i < file_names_count; i++)
|
||||||
if (STREQ (file_names[i], *file_name))
|
if (STREQ (file_names[i], *file_name))
|
||||||
{
|
{
|
||||||
complain (Wother, _("conflicting outputs to file %s"),
|
complain (NULL, Wother, _("conflicting outputs to file %s"),
|
||||||
quote (*file_name));
|
quote (*file_name));
|
||||||
conflict = true;
|
conflict = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -427,8 +427,8 @@ skeleton_arg (char const *arg, int prio, location loc)
|
|||||||
skeleton = arg;
|
skeleton = arg;
|
||||||
}
|
}
|
||||||
else if (prio == skeleton_prio)
|
else if (prio == skeleton_prio)
|
||||||
complain_at (loc, complaint,
|
complain (&loc, complaint,
|
||||||
_("multiple skeleton declarations are invalid"));
|
_("multiple skeleton declarations are invalid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -453,7 +453,7 @@ language_argmatch (char const *arg, int prio, location loc)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
complain_at (loc, complaint, msg, quotearg_colon (arg));
|
complain (&loc, complaint, msg, quotearg_colon (arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------.
|
/*----------------------.
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ grammar_rules_useless_report (const char *message)
|
|||||||
for (r = 0; r < nrules ; ++r)
|
for (r = 0; r < nrules ; ++r)
|
||||||
if (!rules[r].useful)
|
if (!rules[r].useful)
|
||||||
{
|
{
|
||||||
complain_at (rules[r].location, w | silent, "%s: ", message);
|
complain (&rules[r].location, w | silent, "%s: ", message);
|
||||||
rule_print (&rules[r], stderr);
|
rule_print (&rules[r], stderr);
|
||||||
warnings_print_categories (w);
|
warnings_print_categories (w);
|
||||||
fprintf (stderr, "\n");
|
fprintf (stderr, "\n");
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ location_compute (location *loc, boundary *cur, char const *token, size_t size)
|
|||||||
loc->end = *cur;
|
loc->end = *cur;
|
||||||
|
|
||||||
if (line == INT_MAX && loc->start.line != INT_MAX)
|
if (line == INT_MAX && loc->start.line != INT_MAX)
|
||||||
complain_at (*loc, Wother, _("line number overflow"));
|
complain (loc, Wother, _("line number overflow"));
|
||||||
if (column == INT_MAX && loc->start.column != INT_MAX)
|
if (column == INT_MAX && loc->start.column != INT_MAX)
|
||||||
complain_at (*loc, Wother, _("column number overflow"));
|
complain (loc, Wother, _("column number overflow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -407,9 +407,9 @@ muscle_percent_variable_update (char const *variable, location variable_loc)
|
|||||||
if (STREQ (conversion[i].obsolete, variable))
|
if (STREQ (conversion[i].obsolete, variable))
|
||||||
{
|
{
|
||||||
res = conversion[i].updated;
|
res = conversion[i].updated;
|
||||||
complain_at (variable_loc, Wdeprecated,
|
complain (&variable_loc, Wdeprecated,
|
||||||
_("deprecated %%define variable name: %s, use %s"),
|
_("deprecated %%define variable name: %s, use %s"),
|
||||||
quote (variable), quote_n (1, res));
|
quote (variable), quote_n (1, res));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@@ -503,7 +503,7 @@ muscle_percent_define_get_loc (char const *variable)
|
|||||||
{
|
{
|
||||||
char const *loc_name = UNIQSTR_CONCAT ("percent_define_loc(", variable, ")");
|
char const *loc_name = UNIQSTR_CONCAT ("percent_define_loc(", variable, ")");
|
||||||
if (!muscle_find_const (loc_name))
|
if (!muscle_find_const (loc_name))
|
||||||
complain (fatal, _("%s: undefined %%define variable %s"),
|
complain (NULL, fatal, _("%s: undefined %%define variable %s"),
|
||||||
"muscle_percent_define_get_loc", quote (variable));
|
"muscle_percent_define_get_loc", quote (variable));
|
||||||
return location_decode (loc_name);
|
return location_decode (loc_name);
|
||||||
}
|
}
|
||||||
@@ -515,7 +515,7 @@ muscle_percent_define_get_syncline (char const *variable)
|
|||||||
UNIQSTR_CONCAT ("percent_define_syncline(", variable, ")");
|
UNIQSTR_CONCAT ("percent_define_syncline(", variable, ")");
|
||||||
char const *syncline = muscle_find_const (syncline_name);
|
char const *syncline = muscle_find_const (syncline_name);
|
||||||
if (!syncline)
|
if (!syncline)
|
||||||
complain (fatal, _("%s: undefined %%define variable %s"),
|
complain (NULL, fatal, _("%s: undefined %%define variable %s"),
|
||||||
"muscle_percent_define_get_syncline", quote (variable));
|
"muscle_percent_define_get_syncline", quote (variable));
|
||||||
return syncline;
|
return syncline;
|
||||||
}
|
}
|
||||||
@@ -554,14 +554,14 @@ muscle_percent_define_flag_if (char const *variable)
|
|||||||
{
|
{
|
||||||
muscle_insert (invalid_boolean_name, "");
|
muscle_insert (invalid_boolean_name, "");
|
||||||
location loc = muscle_percent_define_get_loc (variable);
|
location loc = muscle_percent_define_get_loc (variable);
|
||||||
complain_at (loc, complaint,
|
complain (&loc, complaint,
|
||||||
_("invalid value for %%define Boolean variable %s"),
|
_("invalid value for %%define Boolean variable %s"),
|
||||||
quote (variable));
|
quote (variable));
|
||||||
}
|
}
|
||||||
free (value);
|
free (value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
complain (fatal, _("%s: undefined %%define variable %s"),
|
complain (NULL, fatal, _("%s: undefined %%define variable %s"),
|
||||||
"muscle_percent_define_flag", quote (variable));
|
"muscle_percent_define_flag", quote (variable));
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -623,7 +623,7 @@ muscle_percent_define_check_values (char const * const *values)
|
|||||||
free (value);
|
free (value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
complain (fatal, _("%s: undefined %%define variable %s"),
|
complain (NULL, fatal, _("%s: undefined %%define variable %s"),
|
||||||
"muscle_percent_define_check_values", quote (*variablep));
|
"muscle_percent_define_check_values", quote (*variablep));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.6.2.873-d87e-dirty. */
|
/* A Bison parser, made by GNU Bison 2.6.2.891-3f15-dirty. */
|
||||||
|
|
||||||
/* Bison implementation for Yacc-like parsers in C
|
/* Bison implementation for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
#define YYBISON 1
|
#define YYBISON 1
|
||||||
|
|
||||||
/* Bison version. */
|
/* Bison version. */
|
||||||
#define YYBISON_VERSION "2.6.2.873-d87e-dirty"
|
#define YYBISON_VERSION "2.6.2.891-3f15-dirty"
|
||||||
|
|
||||||
/* Skeleton name. */
|
/* Skeleton name. */
|
||||||
#define YYSKELETON_NAME "yacc.c"
|
#define YYSKELETON_NAME "yacc.c"
|
||||||
@@ -148,8 +148,8 @@ static char const *char_name (char);
|
|||||||
|
|
||||||
/* In a future release of Bison, this section will be replaced
|
/* In a future release of Bison, this section will be replaced
|
||||||
by #include "src/parse-gram.h". */
|
by #include "src/parse-gram.h". */
|
||||||
#ifndef GRAM_SRC_PARSE_GRAM_H
|
#ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
|
||||||
# define GRAM_SRC_PARSE_GRAM_H
|
# define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG 1
|
# define YYDEBUG 1
|
||||||
@@ -344,7 +344,7 @@ typedef struct YYLTYPE
|
|||||||
|
|
||||||
int gram_parse (void);
|
int gram_parse (void);
|
||||||
|
|
||||||
#endif /* !GRAM_SRC_PARSE_GRAM_H */
|
#endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
|
||||||
|
|
||||||
/* Copy the second part of user declarations. */
|
/* Copy the second part of user declarations. */
|
||||||
|
|
||||||
@@ -3264,8 +3264,7 @@ add_param (param_type type, char *decl, location loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! name_start)
|
if (! name_start)
|
||||||
complain_at (loc, complaint,
|
complain (&loc, complaint, _("missing identifier in parameter declaration"));
|
||||||
_("missing identifier in parameter declaration"));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
|
char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
|
||||||
@@ -3285,8 +3284,8 @@ version_check (location const *loc, char const *version)
|
|||||||
{
|
{
|
||||||
if (strverscmp (version, PACKAGE_VERSION) > 0)
|
if (strverscmp (version, PACKAGE_VERSION) > 0)
|
||||||
{
|
{
|
||||||
complain_at (*loc, complaint, "require bison %s, but have %s",
|
complain (loc, complaint, "require bison %s, but have %s",
|
||||||
version, PACKAGE_VERSION);
|
version, PACKAGE_VERSION);
|
||||||
exit (EX_MISMATCH);
|
exit (EX_MISMATCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3294,7 +3293,7 @@ version_check (location const *loc, char const *version)
|
|||||||
static void
|
static void
|
||||||
gram_error (location const *loc, char const *msg)
|
gram_error (location const *loc, char const *msg)
|
||||||
{
|
{
|
||||||
complain_at (*loc, complaint, "%s", msg);
|
complain (loc, complaint, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
char const *
|
char const *
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.6.2.873-d87e-dirty. */
|
/* A Bison parser, made by GNU Bison 2.6.2.891-3f15-dirty. */
|
||||||
|
|
||||||
/* Bison interface for Yacc-like parsers in C
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
This special exception was added by the Free Software Foundation in
|
This special exception was added by the Free Software Foundation in
|
||||||
version 2.2 of Bison. */
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
#ifndef GRAM_SRC_PARSE_GRAM_H
|
#ifndef YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
|
||||||
# define GRAM_SRC_PARSE_GRAM_H
|
# define YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG 1
|
# define YYDEBUG 1
|
||||||
@@ -226,4 +226,4 @@ typedef struct YYLTYPE
|
|||||||
|
|
||||||
int gram_parse (void);
|
int gram_parse (void);
|
||||||
|
|
||||||
#endif /* !GRAM_SRC_PARSE_GRAM_H */
|
#endif /* !YY_GRAM_SRC_PARSE_GRAM_H_INCLUDED */
|
||||||
|
|||||||
@@ -786,8 +786,7 @@ add_param (param_type type, char *decl, location loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! name_start)
|
if (! name_start)
|
||||||
complain_at (loc, complaint,
|
complain (&loc, complaint, _("missing identifier in parameter declaration"));
|
||||||
_("missing identifier in parameter declaration"));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
|
char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
|
||||||
@@ -807,8 +806,8 @@ version_check (location const *loc, char const *version)
|
|||||||
{
|
{
|
||||||
if (strverscmp (version, PACKAGE_VERSION) > 0)
|
if (strverscmp (version, PACKAGE_VERSION) > 0)
|
||||||
{
|
{
|
||||||
complain_at (*loc, complaint, "require bison %s, but have %s",
|
complain (loc, complaint, "require bison %s, but have %s",
|
||||||
version, PACKAGE_VERSION);
|
version, PACKAGE_VERSION);
|
||||||
exit (EX_MISMATCH);
|
exit (EX_MISMATCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -816,7 +815,7 @@ version_check (location const *loc, char const *version)
|
|||||||
static void
|
static void
|
||||||
gram_error (location const *loc, char const *msg)
|
gram_error (location const *loc, char const *msg)
|
||||||
{
|
{
|
||||||
complain_at (*loc, complaint, "%s", msg);
|
complain (loc, complaint, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
char const *
|
char const *
|
||||||
|
|||||||
52
src/reader.c
52
src/reader.c
@@ -59,7 +59,7 @@ void
|
|||||||
grammar_start_symbol_set (symbol *sym, location loc)
|
grammar_start_symbol_set (symbol *sym, location loc)
|
||||||
{
|
{
|
||||||
if (start_flag)
|
if (start_flag)
|
||||||
complain_at (loc, complaint, _("multiple %s declarations"), "%start");
|
complain (&loc, complaint, _("multiple %s declarations"), "%start");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start_flag = true;
|
start_flag = true;
|
||||||
@@ -202,9 +202,9 @@ assign_named_ref (symbol_list *p, named_ref *name)
|
|||||||
|
|
||||||
if (name->id == sym->tag)
|
if (name->id == sym->tag)
|
||||||
{
|
{
|
||||||
complain_at (name->loc, Wother,
|
complain (&name->loc, Wother,
|
||||||
_("duplicated symbol name for %s ignored"),
|
_("duplicated symbol name for %s ignored"),
|
||||||
quote (sym->tag));
|
quote (sym->tag));
|
||||||
named_ref_free (name);
|
named_ref_free (name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -247,8 +247,8 @@ grammar_current_rule_begin (symbol *lhs, location loc,
|
|||||||
++nvars;
|
++nvars;
|
||||||
}
|
}
|
||||||
else if (lhs->class == token_sym)
|
else if (lhs->class == token_sym)
|
||||||
complain_at (loc, complaint, _("rule given for %s, which is a token"),
|
complain (&loc, complaint, _("rule given for %s, which is a token"),
|
||||||
lhs->tag);
|
lhs->tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -302,14 +302,14 @@ grammar_rule_check (const symbol_list *r)
|
|||||||
const char *rhs_type =
|
const char *rhs_type =
|
||||||
first_rhs->type_name ? first_rhs->type_name : "";
|
first_rhs->type_name ? first_rhs->type_name : "";
|
||||||
if (!UNIQSTR_EQ (lhs_type, rhs_type))
|
if (!UNIQSTR_EQ (lhs_type, rhs_type))
|
||||||
complain_at (r->location, Wother,
|
complain (&r->location, Wother,
|
||||||
_("type clash on default action: <%s> != <%s>"),
|
_("type clash on default action: <%s> != <%s>"),
|
||||||
lhs_type, rhs_type);
|
lhs_type, rhs_type);
|
||||||
}
|
}
|
||||||
/* Warn if there is no default for $$ but we need one. */
|
/* Warn if there is no default for $$ but we need one. */
|
||||||
else
|
else
|
||||||
complain_at (r->location, Wother,
|
complain (&r->location, Wother,
|
||||||
_("empty rule for typed nonterminal, and no action"));
|
_("empty rule for typed nonterminal, and no action"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check that symbol values that should be used are in fact used. */
|
/* Check that symbol values that should be used are in fact used. */
|
||||||
@@ -326,9 +326,9 @@ grammar_rule_check (const symbol_list *r)
|
|||||||
{
|
{
|
||||||
warnings warn_flag = midrule_warning ? Wmidrule_values : Wother;
|
warnings warn_flag = midrule_warning ? Wmidrule_values : Wother;
|
||||||
if (n)
|
if (n)
|
||||||
complain_at (r->location, warn_flag, _("unused value: $%d"), n);
|
complain (&r->location, warn_flag, _("unused value: $%d"), n);
|
||||||
else
|
else
|
||||||
complain_at (r->location, warn_flag, _("unset value: $$"));
|
complain (&r->location, warn_flag, _("unset value: $$"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,8 +339,8 @@ grammar_rule_check (const symbol_list *r)
|
|||||||
if (r->ruleprec
|
if (r->ruleprec
|
||||||
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
|
&& r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"'
|
||||||
&& r->ruleprec->status != declared && !r->ruleprec->prec)
|
&& r->ruleprec->status != declared && !r->ruleprec->prec)
|
||||||
complain_at (r->location, Wother,
|
complain (&r->location, Wother,
|
||||||
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
|
_("token for %%prec is not defined: %s"), r->ruleprec->tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ grammar_current_rule_prec_set (symbol *precsym, location loc)
|
|||||||
token. */
|
token. */
|
||||||
symbol_class_set (precsym, token_sym, loc, false);
|
symbol_class_set (precsym, token_sym, loc, false);
|
||||||
if (current_rule->ruleprec)
|
if (current_rule->ruleprec)
|
||||||
complain_at (loc, complaint, _("only one %s allowed per rule"), "%prec");
|
complain (&loc, complaint, _("only one %s allowed per rule"), "%prec");
|
||||||
current_rule->ruleprec = precsym;
|
current_rule->ruleprec = precsym;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,13 +440,13 @@ void
|
|||||||
grammar_current_rule_dprec_set (int dprec, location loc)
|
grammar_current_rule_dprec_set (int dprec, location loc)
|
||||||
{
|
{
|
||||||
if (! glr_parser)
|
if (! glr_parser)
|
||||||
complain_at (loc, Wother, _("%s affects only GLR parsers"),
|
complain (&loc, Wother, _("%s affects only GLR parsers"),
|
||||||
"%dprec");
|
"%dprec");
|
||||||
if (dprec <= 0)
|
if (dprec <= 0)
|
||||||
complain_at (loc, complaint, _("%s must be followed by positive number"),
|
complain (&loc, complaint, _("%s must be followed by positive number"),
|
||||||
"%dprec");
|
"%dprec");
|
||||||
else if (current_rule->dprec != 0)
|
else if (current_rule->dprec != 0)
|
||||||
complain_at (loc, complaint, _("only one %s allowed per rule"), "%dprec");
|
complain (&loc, complaint, _("only one %s allowed per rule"), "%dprec");
|
||||||
current_rule->dprec = dprec;
|
current_rule->dprec = dprec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,10 +457,10 @@ void
|
|||||||
grammar_current_rule_merge_set (uniqstr name, location loc)
|
grammar_current_rule_merge_set (uniqstr name, location loc)
|
||||||
{
|
{
|
||||||
if (! glr_parser)
|
if (! glr_parser)
|
||||||
complain_at (loc, Wother, _("%s affects only GLR parsers"),
|
complain (&loc, Wother, _("%s affects only GLR parsers"),
|
||||||
"%merge");
|
"%merge");
|
||||||
if (current_rule->merger != 0)
|
if (current_rule->merger != 0)
|
||||||
complain_at (loc, complaint, _("only one %s allowed per rule"), "%merge");
|
complain (&loc, complaint, _("only one %s allowed per rule"), "%merge");
|
||||||
current_rule->merger = get_merge_function (name);
|
current_rule->merger = get_merge_function (name);
|
||||||
current_rule->merger_declaration_location = loc;
|
current_rule->merger_declaration_location = loc;
|
||||||
}
|
}
|
||||||
@@ -559,7 +559,7 @@ packgram (void)
|
|||||||
/* Don't allow rule_length == INT_MAX, since that might
|
/* Don't allow rule_length == INT_MAX, since that might
|
||||||
cause confusion with strtol if INT_MAX == LONG_MAX. */
|
cause confusion with strtol if INT_MAX == LONG_MAX. */
|
||||||
if (rule_length == INT_MAX)
|
if (rule_length == INT_MAX)
|
||||||
complain_at (rules[ruleno].location, fatal, _("rule is too long"));
|
complain (&rules[ruleno].location, fatal, _("rule is too long"));
|
||||||
|
|
||||||
/* item_number = symbol_number.
|
/* item_number = symbol_number.
|
||||||
But the former needs to contain more: negative rule numbers. */
|
But the former needs to contain more: negative rule numbers. */
|
||||||
@@ -677,7 +677,7 @@ check_and_convert_grammar (void)
|
|||||||
{
|
{
|
||||||
/* Grammar has been read. Do some checking. */
|
/* Grammar has been read. Do some checking. */
|
||||||
if (nrules == 0)
|
if (nrules == 0)
|
||||||
complain (fatal, _("no rules in the input grammar"));
|
complain (NULL, fatal, _("no rules in the input grammar"));
|
||||||
|
|
||||||
/* If the user did not define her ENDTOKEN, do it now. */
|
/* If the user did not define her ENDTOKEN, do it now. */
|
||||||
if (!endtoken)
|
if (!endtoken)
|
||||||
|
|||||||
24
src/reduce.c
24
src/reduce.c
@@ -299,9 +299,9 @@ nonterminals_reduce (void)
|
|||||||
{
|
{
|
||||||
nontermmap[i - ntokens] = n++;
|
nontermmap[i - ntokens] = n++;
|
||||||
if (symbols[i]->status != used)
|
if (symbols[i]->status != used)
|
||||||
complain_at (symbols[i]->location, Wother,
|
complain (&symbols[i]->location, Wother,
|
||||||
_("nonterminal useless in grammar: %s"),
|
_("nonterminal useless in grammar: %s"),
|
||||||
symbols[i]->tag);
|
symbols[i]->tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -383,14 +383,14 @@ static void
|
|||||||
reduce_print (void)
|
reduce_print (void)
|
||||||
{
|
{
|
||||||
if (nuseless_nonterminals > 0)
|
if (nuseless_nonterminals > 0)
|
||||||
complain (Wother, ngettext ("%d nonterminal useless in grammar",
|
complain (NULL, Wother, ngettext ("%d nonterminal useless in grammar",
|
||||||
"%d nonterminals useless in grammar",
|
"%d nonterminals useless in grammar",
|
||||||
nuseless_nonterminals),
|
nuseless_nonterminals),
|
||||||
nuseless_nonterminals);
|
nuseless_nonterminals);
|
||||||
if (nuseless_productions > 0)
|
if (nuseless_productions > 0)
|
||||||
complain (Wother, ngettext ("%d rule useless in grammar",
|
complain (NULL, Wother, ngettext ("%d rule useless in grammar",
|
||||||
"%d rules useless in grammar",
|
"%d rules useless in grammar",
|
||||||
nuseless_productions),
|
nuseless_productions),
|
||||||
nuseless_productions);
|
nuseless_productions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,9 +416,9 @@ reduce_grammar (void)
|
|||||||
reduce_print ();
|
reduce_print ();
|
||||||
|
|
||||||
if (!bitset_test (N, accept->number - ntokens))
|
if (!bitset_test (N, accept->number - ntokens))
|
||||||
complain_at (startsymbol_location, fatal,
|
complain (&startsymbol_location, fatal,
|
||||||
_("start symbol %s does not derive any sentence"),
|
_("start symbol %s does not derive any sentence"),
|
||||||
startsymbol->tag);
|
startsymbol->tag);
|
||||||
|
|
||||||
/* First reduce the nonterminals, as they renumber themselves in the
|
/* First reduce the nonterminals, as they renumber themselves in the
|
||||||
whole grammar. If you change the order, nonterms would be
|
whole grammar. If you change the order, nonterms would be
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
BEGIN SC_LINE_COMMENT;
|
BEGIN SC_LINE_COMMENT;
|
||||||
}
|
}
|
||||||
[$@] {
|
[$@] {
|
||||||
complain_at (*loc, Wother, _("stray '%s'"), yytext);
|
complain (loc, Wother, _("stray '%s'"), yytext);
|
||||||
obstack_escape (&obstack_for_string, yytext);
|
obstack_escape (&obstack_for_string, yytext);
|
||||||
need_semicolon = true;
|
need_semicolon = true;
|
||||||
}
|
}
|
||||||
@@ -225,10 +225,8 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
if (outer_brace && !yacc_flag && language_prio == default_prio
|
if (outer_brace && !yacc_flag && language_prio == default_prio
|
||||||
&& skeleton_prio == default_prio && need_semicolon && ! in_cpp)
|
&& skeleton_prio == default_prio && need_semicolon && ! in_cpp)
|
||||||
{
|
{
|
||||||
complain_at (*loc, Wdeprecated,
|
complain (loc, Wdeprecated, _("a ';' might be needed at the end of action code"));
|
||||||
_("a ';' might be needed at the end of action code"));
|
complain (loc, Wdeprecated, _("future versions of Bison will not add the ';'"));
|
||||||
complain_at (*loc, Wdeprecated,
|
|
||||||
_("future versions of Bison will not add the ';'"));
|
|
||||||
obstack_1grow (&obstack_for_string, ';');
|
obstack_1grow (&obstack_for_string, ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,8 +497,8 @@ parse_ref (char *cp, symbol_list *rule, int rule_length,
|
|||||||
return num;
|
return num;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
complain_at (text_loc, complaint, _("integer out of range: %s"),
|
complain (&text_loc, complaint, _("integer out of range: %s"),
|
||||||
quote (text));
|
quote (text));
|
||||||
return INVALID_REF;
|
return INVALID_REF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -673,8 +671,8 @@ fetch_type_name (char *cp, char const **type_name,
|
|||||||
'text' is needed for error messages. */
|
'text' is needed for error messages. */
|
||||||
++cp;
|
++cp;
|
||||||
if (untyped_var_seen)
|
if (untyped_var_seen)
|
||||||
complain_at (dollar_loc, complaint,
|
complain (&dollar_loc, complaint,
|
||||||
_("explicit type given in untyped grammar"));
|
_("explicit type given in untyped grammar"));
|
||||||
tag_seen = true;
|
tag_seen = true;
|
||||||
}
|
}
|
||||||
return cp;
|
return cp;
|
||||||
@@ -732,15 +730,15 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
|
|||||||
if (union_seen | tag_seen)
|
if (union_seen | tag_seen)
|
||||||
{
|
{
|
||||||
if (rule->midrule_parent_rule)
|
if (rule->midrule_parent_rule)
|
||||||
complain_at (dollar_loc, complaint,
|
complain (&dollar_loc, complaint,
|
||||||
_("$$ for the midrule at $%d of %s"
|
_("$$ for the midrule at $%d of %s"
|
||||||
" has no declared type"),
|
" has no declared type"),
|
||||||
rule->midrule_parent_rhs_index,
|
rule->midrule_parent_rhs_index,
|
||||||
quote (effective_rule->content.sym->tag));
|
quote (effective_rule->content.sym->tag));
|
||||||
else
|
else
|
||||||
complain_at (dollar_loc, complaint,
|
complain (&dollar_loc, complaint,
|
||||||
_("$$ of %s has no declared type"),
|
_("$$ of %s has no declared type"),
|
||||||
quote (rule->content.sym->tag));
|
quote (rule->content.sym->tag));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
untyped_var_seen = true;
|
untyped_var_seen = true;
|
||||||
@@ -761,9 +759,9 @@ handle_action_dollar (symbol_list *rule, char *text, location dollar_loc)
|
|||||||
if (!type_name)
|
if (!type_name)
|
||||||
{
|
{
|
||||||
if (union_seen | tag_seen)
|
if (union_seen | tag_seen)
|
||||||
complain_at (dollar_loc, complaint,
|
complain (&dollar_loc, complaint,
|
||||||
_("$%s of %s has no declared type"), cp,
|
_("$%s of %s has no declared type"), cp,
|
||||||
quote (effective_rule->content.sym->tag));
|
quote (effective_rule->content.sym->tag));
|
||||||
else
|
else
|
||||||
untyped_var_seen = true;
|
untyped_var_seen = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
{
|
{
|
||||||
/* Comments and white space. */
|
/* Comments and white space. */
|
||||||
"," {
|
"," {
|
||||||
complain_at (*loc, Wother, _("stray ',' treated as white space"));
|
complain (loc, Wother, _("stray ',' treated as white space"));
|
||||||
}
|
}
|
||||||
[ \f\n\t\v] |
|
[ \f\n\t\v] |
|
||||||
"//".* ;
|
"//".* ;
|
||||||
@@ -241,7 +241,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
"%yacc" return PERCENT_YACC;
|
"%yacc" return PERCENT_YACC;
|
||||||
|
|
||||||
{directive} {
|
{directive} {
|
||||||
complain_at (*loc, complaint, _("invalid directive: %s"), quote (yytext));
|
complain (loc, complaint, _("invalid directive: %s"), quote (yytext));
|
||||||
}
|
}
|
||||||
|
|
||||||
"=" return EQUAL;
|
"=" return EQUAL;
|
||||||
@@ -267,7 +267,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
/* Identifiers may not start with a digit. Yet, don't silently
|
/* Identifiers may not start with a digit. Yet, don't silently
|
||||||
accept "1FOO" as "1 FOO". */
|
accept "1FOO" as "1 FOO". */
|
||||||
{int}{id} {
|
{int}{id} {
|
||||||
complain_at (*loc, complaint, _("invalid identifier: %s"), quote (yytext));
|
complain (loc, complaint, _("invalid identifier: %s"), quote (yytext));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Characters. */
|
/* Characters. */
|
||||||
@@ -325,7 +325,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
}
|
}
|
||||||
|
|
||||||
. {
|
. {
|
||||||
complain_at (*loc, complaint, _("invalid character: %s"), quote (yytext));
|
complain (loc, complaint, _("invalid character: %s"), quote (yytext));
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
@@ -342,7 +342,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
|
|
||||||
<SC_ESCAPED_CHARACTER,SC_ESCAPED_STRING,SC_TAG>
|
<SC_ESCAPED_CHARACTER,SC_ESCAPED_STRING,SC_TAG>
|
||||||
{
|
{
|
||||||
\0 complain_at (*loc, complaint, _("invalid null character"));
|
\0 complain (loc, complaint, _("invalid null character"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -394,9 +394,9 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
{id} {
|
{id} {
|
||||||
if (bracketed_id_str)
|
if (bracketed_id_str)
|
||||||
{
|
{
|
||||||
complain_at (*loc, complaint,
|
complain (loc, complaint,
|
||||||
_("unexpected identifier in bracketed name: %s"),
|
_("unexpected identifier in bracketed name: %s"),
|
||||||
quote (yytext));
|
quote (yytext));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -417,10 +417,10 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
complain_at (*loc, complaint, _("an identifier expected"));
|
complain (loc, complaint, _("an identifier expected"));
|
||||||
}
|
}
|
||||||
. {
|
. {
|
||||||
complain_at (*loc, complaint, _("invalid character in bracketed name: %s"),
|
complain (loc, complaint, _("invalid character in bracketed name: %s"),
|
||||||
quote (yytext));
|
quote (yytext));
|
||||||
}
|
}
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
@@ -518,12 +518,12 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
/* FIXME: Eventually, make these errors. */
|
/* FIXME: Eventually, make these errors. */
|
||||||
if (last_string[0] == '\0')
|
if (last_string[0] == '\0')
|
||||||
{
|
{
|
||||||
complain_at (*loc, Wother, _("empty character literal"));
|
complain (loc, Wother, _("empty character literal"));
|
||||||
/* '\0' seems dangerous even if we are about to complain. */
|
/* '\0' seems dangerous even if we are about to complain. */
|
||||||
val->character = '\'';
|
val->character = '\'';
|
||||||
}
|
}
|
||||||
else if (last_string[1] != '\0')
|
else if (last_string[1] != '\0')
|
||||||
complain_at (*loc, Wother,
|
complain (loc, Wother,
|
||||||
_("extra characters in character literal"));
|
_("extra characters in character literal"));
|
||||||
}
|
}
|
||||||
if (yytext[0] == '\n')
|
if (yytext[0] == '\n')
|
||||||
@@ -540,12 +540,12 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
/* FIXME: Eventually, make these errors. */
|
/* FIXME: Eventually, make these errors. */
|
||||||
if (last_string[0] == '\0')
|
if (last_string[0] == '\0')
|
||||||
{
|
{
|
||||||
complain_at (*loc, Wother, _("empty character literal"));
|
complain (loc, Wother, _("empty character literal"));
|
||||||
/* '\0' seems dangerous even if we are about to complain. */
|
/* '\0' seems dangerous even if we are about to complain. */
|
||||||
val->character = '\'';
|
val->character = '\'';
|
||||||
}
|
}
|
||||||
else if (last_string[1] != '\0')
|
else if (last_string[1] != '\0')
|
||||||
complain_at (*loc, Wother,
|
complain (loc, Wother,
|
||||||
_("extra characters in character literal"));
|
_("extra characters in character literal"));
|
||||||
}
|
}
|
||||||
unexpected_eof (token_start, "'");
|
unexpected_eof (token_start, "'");
|
||||||
@@ -599,7 +599,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
\\[0-7]{1,3} {
|
\\[0-7]{1,3} {
|
||||||
unsigned long int c = strtoul (yytext + 1, NULL, 8);
|
unsigned long int c = strtoul (yytext + 1, NULL, 8);
|
||||||
if (!c || UCHAR_MAX < c)
|
if (!c || UCHAR_MAX < c)
|
||||||
complain_at (*loc, complaint, _("invalid number after \\-escape: %s"),
|
complain (loc, complaint, _("invalid number after \\-escape: %s"),
|
||||||
yytext+1);
|
yytext+1);
|
||||||
else
|
else
|
||||||
obstack_1grow (&obstack_for_string, c);
|
obstack_1grow (&obstack_for_string, c);
|
||||||
@@ -609,7 +609,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
verify (UCHAR_MAX < ULONG_MAX);
|
verify (UCHAR_MAX < ULONG_MAX);
|
||||||
unsigned long int c = strtoul (yytext + 2, NULL, 16);
|
unsigned long int c = strtoul (yytext + 2, NULL, 16);
|
||||||
if (!c || UCHAR_MAX < c)
|
if (!c || UCHAR_MAX < c)
|
||||||
complain_at (*loc, complaint, _("invalid number after \\-escape: %s"),
|
complain (loc, complaint, _("invalid number after \\-escape: %s"),
|
||||||
yytext+1);
|
yytext+1);
|
||||||
else
|
else
|
||||||
obstack_1grow (&obstack_for_string, c);
|
obstack_1grow (&obstack_for_string, c);
|
||||||
@@ -629,7 +629,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
\\(u|U[0-9abcdefABCDEF]{4})[0-9abcdefABCDEF]{4} {
|
\\(u|U[0-9abcdefABCDEF]{4})[0-9abcdefABCDEF]{4} {
|
||||||
int c = convert_ucn_to_byte (yytext);
|
int c = convert_ucn_to_byte (yytext);
|
||||||
if (c <= 0)
|
if (c <= 0)
|
||||||
complain_at (*loc, complaint, _("invalid number after \\-escape: %s"),
|
complain (loc, complaint, _("invalid number after \\-escape: %s"),
|
||||||
yytext+1);
|
yytext+1);
|
||||||
else
|
else
|
||||||
obstack_1grow (&obstack_for_string, c);
|
obstack_1grow (&obstack_for_string, c);
|
||||||
@@ -641,7 +641,7 @@ splice (\\[ \f\t\v]*\n)*
|
|||||||
p = quote (p);
|
p = quote (p);
|
||||||
else
|
else
|
||||||
p = quotearg_style_mem (escape_quoting_style, p, 1);
|
p = quotearg_style_mem (escape_quoting_style, p, 1);
|
||||||
complain_at (*loc, complaint, _("invalid character after \\-escape: %s"),
|
complain (loc, complaint, _("invalid character after \\-escape: %s"),
|
||||||
p);
|
p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -873,7 +873,7 @@ scan_integer (char const *number, int base, location loc)
|
|||||||
|
|
||||||
if (INT_MAX < num)
|
if (INT_MAX < num)
|
||||||
{
|
{
|
||||||
complain_at (loc, complaint, _("integer out of range: %s"),
|
complain (&loc, complaint, _("integer out of range: %s"),
|
||||||
quote (number));
|
quote (number));
|
||||||
num = INT_MAX;
|
num = INT_MAX;
|
||||||
}
|
}
|
||||||
@@ -952,7 +952,7 @@ handle_syncline (char *args, location loc)
|
|||||||
*strchr (file, '"') = '\0';
|
*strchr (file, '"') = '\0';
|
||||||
if (INT_MAX <= lineno)
|
if (INT_MAX <= lineno)
|
||||||
{
|
{
|
||||||
complain_at (loc, Wother, _("line number overflow"));
|
complain (&loc, Wother, _("line number overflow"));
|
||||||
lineno = INT_MAX;
|
lineno = INT_MAX;
|
||||||
}
|
}
|
||||||
current_file = uniqstr_new (file);
|
current_file = uniqstr_new (file);
|
||||||
@@ -976,7 +976,7 @@ unexpected_end (boundary start, char const *msgid, char const *token_end)
|
|||||||
// Instead of '\'', display "'".
|
// Instead of '\'', display "'".
|
||||||
if (STREQ (token_end, "'\\''"))
|
if (STREQ (token_end, "'\\''"))
|
||||||
token_end = "\"'\"";
|
token_end = "\"'\"";
|
||||||
complain_at (loc, complaint, _(msgid), token_end);
|
complain (&loc, complaint, _(msgid), token_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ static void fail_for_invalid_at (char const *at);
|
|||||||
|
|
||||||
<SC_AT_DIRECTIVE_ARGS,SC_AT_DIRECTIVE_SKIP_WS>
|
<SC_AT_DIRECTIVE_ARGS,SC_AT_DIRECTIVE_SKIP_WS>
|
||||||
{
|
{
|
||||||
<<EOF>> complain (fatal, _("unclosed %s directive in skeleton"), argv[0]);
|
<<EOF>> complain (NULL, fatal, _("unclosed %s directive in skeleton"), argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
@@ -194,19 +194,19 @@ at_directive_perform (int argc, char *argv[], char **outnamep, int *out_linenop)
|
|||||||
switch (argc)
|
switch (argc)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
complain (w, "%s", _(argv[1]));
|
complain (NULL, w, "%s", _(argv[1]));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
complain (w, _(argv[1]), argv[2]);
|
complain (NULL, w, _(argv[1]), argv[2]);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
complain (w, _(argv[1]), argv[2], argv[3]);
|
complain (NULL, w, _(argv[1]), argv[2], argv[3]);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
complain (w, _(argv[1]), argv[2], argv[3], argv[4]);
|
complain (NULL, w, _(argv[1]), argv[2], argv[3], argv[4]);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
complain (w, _(argv[1]), argv[2], argv[3], argv[4], argv[5]);
|
complain (NULL, w, _(argv[1]), argv[2], argv[3], argv[4], argv[5]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fail_for_at_directive_too_many_args (argv[0]);
|
fail_for_at_directive_too_many_args (argv[0]);
|
||||||
@@ -226,19 +226,19 @@ at_directive_perform (int argc, char *argv[], char **outnamep, int *out_linenop)
|
|||||||
switch (argc)
|
switch (argc)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
complain_at (loc, w, "%s", _(argv[3]));
|
complain (&loc, w, "%s", _(argv[3]));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
complain_at (loc, w, _(argv[3]), argv[4]);
|
complain (&loc, w, _(argv[3]), argv[4]);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
complain_at (loc, w, _(argv[3]), argv[4], argv[5]);
|
complain (&loc, w, _(argv[3]), argv[4], argv[5]);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
complain_at (loc, w, _(argv[3]), argv[4], argv[5], argv[6]);
|
complain (&loc, w, _(argv[3]), argv[4], argv[5], argv[6]);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
complain_at (loc, w, _(argv[3]), argv[4], argv[5], argv[6],
|
complain (&loc, w, _(argv[3]), argv[4], argv[5], argv[6],
|
||||||
argv[7]);
|
argv[7]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -267,19 +267,19 @@ at_directive_perform (int argc, char *argv[], char **outnamep, int *out_linenop)
|
|||||||
static void
|
static void
|
||||||
fail_for_at_directive_too_few_args (char const *at_directive_name)
|
fail_for_at_directive_too_few_args (char const *at_directive_name)
|
||||||
{
|
{
|
||||||
complain (fatal, _("too few arguments for %s directive in skeleton"),
|
complain (NULL, fatal, _("too few arguments for %s directive in skeleton"),
|
||||||
at_directive_name);
|
at_directive_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fail_for_at_directive_too_many_args (char const *at_directive_name)
|
fail_for_at_directive_too_many_args (char const *at_directive_name)
|
||||||
{
|
{
|
||||||
complain (fatal, _("too many arguments for %s directive in skeleton"),
|
complain (NULL, fatal, _("too many arguments for %s directive in skeleton"),
|
||||||
at_directive_name);
|
at_directive_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fail_for_invalid_at (char const *at)
|
fail_for_invalid_at (char const *at)
|
||||||
{
|
{
|
||||||
complain (fatal, "invalid @ in skeleton: %s", at);
|
complain (NULL, fatal, "invalid @ in skeleton: %s", at);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ symbol_list_n_type_name_get (symbol_list *l, location loc, int n)
|
|||||||
l = symbol_list_n_get (l, n);
|
l = symbol_list_n_get (l, n);
|
||||||
if (!l)
|
if (!l)
|
||||||
{
|
{
|
||||||
complain_at (loc, complaint, _("invalid $ value: $%d"), n);
|
complain (&loc, complaint, _("invalid $ value: $%d"), n);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
aver (l->content_type == SYMLIST_SYMBOL);
|
aver (l->content_type == SYMLIST_SYMBOL);
|
||||||
|
|||||||
52
src/symtab.c
52
src/symtab.c
@@ -61,8 +61,8 @@ symbol_new (uniqstr tag, location loc)
|
|||||||
/* If the tag is not a string (starts with a double quote), check
|
/* If the tag is not a string (starts with a double quote), check
|
||||||
that it is valid for Yacc. */
|
that it is valid for Yacc. */
|
||||||
if (tag[0] != '\"' && tag[0] != '\'' && strchr (tag, '-'))
|
if (tag[0] != '\"' && tag[0] != '\'' && strchr (tag, '-'))
|
||||||
complain_at (loc, Wyacc,
|
complain (&loc, Wyacc,
|
||||||
_("POSIX Yacc forbids dashes in symbol names: %s"), tag);
|
_("POSIX Yacc forbids dashes in symbol names: %s"), tag);
|
||||||
|
|
||||||
res->tag = tag;
|
res->tag = tag;
|
||||||
res->location = loc;
|
res->location = loc;
|
||||||
@@ -81,7 +81,7 @@ symbol_new (uniqstr tag, location loc)
|
|||||||
res->status = undeclared;
|
res->status = undeclared;
|
||||||
|
|
||||||
if (nsyms == SYMBOL_NUMBER_MAXIMUM)
|
if (nsyms == SYMBOL_NUMBER_MAXIMUM)
|
||||||
complain (fatal, _("too many symbols in input grammar (limit is %d)"),
|
complain (NULL, fatal, _("too many symbols in input grammar (limit is %d)"),
|
||||||
SYMBOL_NUMBER_MAXIMUM);
|
SYMBOL_NUMBER_MAXIMUM);
|
||||||
nsyms++;
|
nsyms++;
|
||||||
return res;
|
return res;
|
||||||
@@ -328,7 +328,7 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
|||||||
bool warned = false;
|
bool warned = false;
|
||||||
if (sym->class != unknown_sym && sym->class != class)
|
if (sym->class != unknown_sym && sym->class != class)
|
||||||
{
|
{
|
||||||
complain_at (loc, complaint, _("symbol %s redefined"), sym->tag);
|
complain (&loc, complaint, _("symbol %s redefined"), sym->tag);
|
||||||
// Don't report both "redefined" and "redeclared".
|
// Don't report both "redefined" and "redeclared".
|
||||||
warned = true;
|
warned = true;
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,7 @@ symbol_class_set (symbol *sym, symbol_class class, location loc, bool declaring)
|
|||||||
if (declaring)
|
if (declaring)
|
||||||
{
|
{
|
||||||
if (sym->status == declared && !warned)
|
if (sym->status == declared && !warned)
|
||||||
complain_at (loc, Wother, _("symbol %s redeclared"), sym->tag);
|
complain (&loc, Wother, _("symbol %s redeclared"), sym->tag);
|
||||||
sym->status = declared;
|
sym->status = declared;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,8 +364,8 @@ symbol_user_token_number_set (symbol *sym, int user_token_number, location loc)
|
|||||||
user_token_numberp = &sym->alias->user_token_number;
|
user_token_numberp = &sym->alias->user_token_number;
|
||||||
if (*user_token_numberp != USER_NUMBER_UNDEFINED
|
if (*user_token_numberp != USER_NUMBER_UNDEFINED
|
||||||
&& *user_token_numberp != user_token_number)
|
&& *user_token_numberp != user_token_number)
|
||||||
complain_at (loc, complaint, _("redefining user token number of %s"),
|
complain (&loc, complaint, _("redefining user token number of %s"),
|
||||||
sym->tag);
|
sym->tag);
|
||||||
|
|
||||||
*user_token_numberp = user_token_number;
|
*user_token_numberp = user_token_number;
|
||||||
/* User defined $end token? */
|
/* User defined $end token? */
|
||||||
@@ -392,11 +392,11 @@ symbol_check_defined (symbol *sym)
|
|||||||
if (sym->class == unknown_sym)
|
if (sym->class == unknown_sym)
|
||||||
{
|
{
|
||||||
assert (sym->status != declared);
|
assert (sym->status != declared);
|
||||||
complain_at (sym->location,
|
complain (&sym->location,
|
||||||
sym->status == needed ? complaint : Wother,
|
sym->status == needed ? complaint : Wother,
|
||||||
_("symbol %s is used, but is not defined as a token"
|
_("symbol %s is used, but is not defined as a token"
|
||||||
" and has no rules"),
|
" and has no rules"),
|
||||||
sym->tag);
|
sym->tag);
|
||||||
sym->class = nterm_sym;
|
sym->class = nterm_sym;
|
||||||
sym->number = nvars++;
|
sym->number = nvars++;
|
||||||
}
|
}
|
||||||
@@ -427,14 +427,14 @@ semantic_type_check_defined (semantic_type *sem_type)
|
|||||||
for (int i = 0; i < 2; ++i)
|
for (int i = 0; i < 2; ++i)
|
||||||
if (sem_type->props[i].kind != CODE_PROPS_NONE
|
if (sem_type->props[i].kind != CODE_PROPS_NONE
|
||||||
&& ! sem_type->props[i].is_used)
|
&& ! sem_type->props[i].is_used)
|
||||||
complain_at (sem_type->location, Wother,
|
complain (&sem_type->location, Wother,
|
||||||
_("useless %s for type <%s>"),
|
_("useless %s for type <%s>"),
|
||||||
code_props_type_string (i), sem_type->tag);
|
code_props_type_string (i), sem_type->tag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
complain_at (sem_type->location, Wother,
|
complain (&sem_type->location, Wother,
|
||||||
_("type <%s> is used, but is not associated to any symbol"),
|
_("type <%s> is used, but is not associated to any symbol"),
|
||||||
sem_type->tag);
|
sem_type->tag);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -457,10 +457,10 @@ void
|
|||||||
symbol_make_alias (symbol *sym, symbol *str, location loc)
|
symbol_make_alias (symbol *sym, symbol *str, location loc)
|
||||||
{
|
{
|
||||||
if (str->alias)
|
if (str->alias)
|
||||||
complain_at (loc, Wother,
|
complain (&loc, Wother,
|
||||||
_("symbol %s used more than once as a literal string"), str->tag);
|
_("symbol %s used more than once as a literal string"), str->tag);
|
||||||
else if (sym->alias)
|
else if (sym->alias)
|
||||||
complain_at (loc, Wother,
|
complain (&loc, Wother,
|
||||||
_("symbol %s given more than one literal string"), sym->tag);
|
_("symbol %s given more than one literal string"), sym->tag);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -950,11 +950,11 @@ symbols_pack (void)
|
|||||||
symbols_token_translations_init ();
|
symbols_token_translations_init ();
|
||||||
|
|
||||||
if (startsymbol->class == unknown_sym)
|
if (startsymbol->class == unknown_sym)
|
||||||
complain_at (startsymbol_location, fatal,
|
complain (&startsymbol_location, fatal,
|
||||||
_("the start symbol %s is undefined"),
|
_("the start symbol %s is undefined"),
|
||||||
startsymbol->tag);
|
startsymbol->tag);
|
||||||
else if (startsymbol->class == token_sym)
|
else if (startsymbol->class == token_sym)
|
||||||
complain_at (startsymbol_location, fatal,
|
complain (&startsymbol_location, fatal,
|
||||||
_("the start symbol %s is a token"),
|
_("the start symbol %s is a token"),
|
||||||
startsymbol->tag);
|
startsymbol->tag);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user