mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 10:43:02 +00:00
warnings: rename the categories
Forthcoming changes will use the warning categories much more often, so shortening them will improve readability. * src/complain.c, src/complain.h, src/conflicts.c, * src/getargs.c, src/getargs.h, src/gram.c (enum warnings): s/warnings_/W/g.
This commit is contained in:
committed by
Akim Demaille
parent
f124616490
commit
327db05b22
@@ -100,7 +100,7 @@ void
|
|||||||
set_warning_issued (void)
|
set_warning_issued (void)
|
||||||
{
|
{
|
||||||
static bool warning_issued = false;
|
static bool warning_issued = false;
|
||||||
if (!warning_issued && (warnings_flag & warnings_error))
|
if (!warning_issued && (warnings_flag & Werror))
|
||||||
{
|
{
|
||||||
fprintf (stderr, "%s: warnings being treated as errors\n", program_name);
|
fprintf (stderr, "%s: warnings being treated as errors\n", program_name);
|
||||||
complaint_issued = true;
|
complaint_issued = true;
|
||||||
@@ -111,7 +111,7 @@ set_warning_issued (void)
|
|||||||
void
|
void
|
||||||
warn_at (location loc, const char *message, ...)
|
warn_at (location loc, const char *message, ...)
|
||||||
{
|
{
|
||||||
if (!(warnings_flag & warnings_other))
|
if (!(warnings_flag & Wother))
|
||||||
return;
|
return;
|
||||||
set_warning_issued ();
|
set_warning_issued ();
|
||||||
ERROR_MESSAGE (&loc, _("warning"), message);
|
ERROR_MESSAGE (&loc, _("warning"), message);
|
||||||
@@ -121,7 +121,7 @@ void
|
|||||||
warn_at_indent (location loc, unsigned *indent,
|
warn_at_indent (location loc, unsigned *indent,
|
||||||
const char *message, ...)
|
const char *message, ...)
|
||||||
{
|
{
|
||||||
if (!(warnings_flag & warnings_other))
|
if (!(warnings_flag & Wother))
|
||||||
return;
|
return;
|
||||||
set_warning_issued ();
|
set_warning_issued ();
|
||||||
indent_ptr = indent;
|
indent_ptr = indent;
|
||||||
@@ -131,7 +131,7 @@ warn_at_indent (location loc, unsigned *indent,
|
|||||||
void
|
void
|
||||||
warn (const char *message, ...)
|
warn (const char *message, ...)
|
||||||
{
|
{
|
||||||
if (!(warnings_flag & warnings_other))
|
if (!(warnings_flag & Wother))
|
||||||
return;
|
return;
|
||||||
set_warning_issued ();
|
set_warning_issued ();
|
||||||
ERROR_MESSAGE (NULL, _("warning"), message);
|
ERROR_MESSAGE (NULL, _("warning"), message);
|
||||||
@@ -179,7 +179,7 @@ yacc_at (location loc, const char *message, ...)
|
|||||||
ERROR_MESSAGE (&loc, NULL, message);
|
ERROR_MESSAGE (&loc, NULL, message);
|
||||||
complaint_issued = true;
|
complaint_issued = true;
|
||||||
}
|
}
|
||||||
else if (warnings_flag & warnings_yacc)
|
else if (warnings_flag & Wyacc)
|
||||||
{
|
{
|
||||||
set_warning_issued ();
|
set_warning_issued ();
|
||||||
ERROR_MESSAGE (&loc, _("warning"), message);
|
ERROR_MESSAGE (&loc, _("warning"), message);
|
||||||
@@ -189,7 +189,7 @@ yacc_at (location loc, const char *message, ...)
|
|||||||
void
|
void
|
||||||
midrule_value_at (location loc, const char *message, ...)
|
midrule_value_at (location loc, const char *message, ...)
|
||||||
{
|
{
|
||||||
if (!(warnings_flag & warnings_midrule_values))
|
if (!(warnings_flag & Wmidrule_values))
|
||||||
return;
|
return;
|
||||||
set_warning_issued ();
|
set_warning_issued ();
|
||||||
ERROR_MESSAGE (&loc, _("warning"), message);
|
ERROR_MESSAGE (&loc, _("warning"), message);
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ extern "C" {
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
/** Record that a warning is about to be issued, and treat it as an
|
/** 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.
|
only for the sake of Yacc-compatible conflict reports in conflicts.c.
|
||||||
All other warnings should be implemented in complain.c and should use
|
All other warnings should be implemented in complain.c and should use
|
||||||
the normal warning format. */
|
the normal warning format. */
|
||||||
void set_warning_issued (void);
|
void set_warning_issued (void);
|
||||||
|
|
||||||
/** Informative messages, but we proceed. Report iff
|
/** Informative messages, but we proceed. Report iff
|
||||||
<tt>warnings_flag & warnings_other</tt>. */
|
<tt>warnings_flag & Wother</tt>. */
|
||||||
|
|
||||||
void warn (char const *format, ...)
|
void warn (char const *format, ...)
|
||||||
__attribute__ ((__format__ (__printf__, 1, 2)));
|
__attribute__ ((__format__ (__printf__, 1, 2)));
|
||||||
@@ -70,7 +70,7 @@ void yacc_at (location loc, char const *format, ...)
|
|||||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||||
|
|
||||||
/** A midrule-value warning. Report iff
|
/** A midrule-value warning. Report iff
|
||||||
<tt>warnings_flag & warnings_midrule_values</tt>. */
|
<tt>warnings_flag & Wmidrule_values</tt>. */
|
||||||
|
|
||||||
void midrule_value_at (location loc, char const *format, ...)
|
void midrule_value_at (location loc, char const *format, ...)
|
||||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||||
|
|||||||
@@ -601,9 +601,9 @@ conflicts_print (void)
|
|||||||
/* Report the total number of conflicts on STDERR. */
|
/* Report the total number of conflicts on STDERR. */
|
||||||
if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
|
if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
|
||||||
{
|
{
|
||||||
if (!(warnings_flag & warnings_conflicts_sr))
|
if (!(warnings_flag & Wconflicts_sr))
|
||||||
src_total = 0;
|
src_total = 0;
|
||||||
if (!(warnings_flag & warnings_conflicts_rr))
|
if (!(warnings_flag & Wconflicts_rr))
|
||||||
rrc_total = 0;
|
rrc_total = 0;
|
||||||
}
|
}
|
||||||
if (src_total | rrc_total)
|
if (src_total | rrc_total)
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ bool glr_parser = false;
|
|||||||
|
|
||||||
int report_flag = report_none;
|
int report_flag = report_none;
|
||||||
int trace_flag = trace_none;
|
int trace_flag = trace_none;
|
||||||
int warnings_flag = warnings_conflicts_sr | warnings_conflicts_rr
|
int warnings_flag = Wconflicts_sr | Wconflicts_rr
|
||||||
| warnings_other;
|
| Wother;
|
||||||
|
|
||||||
static struct bison_language const valid_languages[] = {
|
static struct bison_language const valid_languages[] = {
|
||||||
{ "c", "c-skel.m4", ".c", ".h", true },
|
{ "c", "c-skel.m4", ".c", ".h", true },
|
||||||
@@ -129,15 +129,15 @@ flags_argmatch (const char *option,
|
|||||||
*
|
*
|
||||||
* \param FlagName the flag familly to update.
|
* \param FlagName the flag familly to update.
|
||||||
* \param Args the effective sub arguments to decode.
|
* \param Args the effective sub arguments to decode.
|
||||||
|
* \param All the "all" value.
|
||||||
*
|
*
|
||||||
* \arg FlagName_args the list of keys.
|
* \arg FlagName_args the list of keys.
|
||||||
* \arg FlagName_types the list of values.
|
* \arg FlagName_types the list of values.
|
||||||
* \arg FlagName_all the all value.
|
|
||||||
* \arg FlagName_flag the flag to update.
|
* \arg FlagName_flag the flag to update.
|
||||||
*/
|
*/
|
||||||
#define FLAGS_ARGMATCH(FlagName, Args) \
|
#define FLAGS_ARGMATCH(FlagName, Args, All) \
|
||||||
flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \
|
flags_argmatch ("--" #FlagName, FlagName ## _args, FlagName ## _types, \
|
||||||
FlagName ## _all, &FlagName ## _flag, Args)
|
All, &FlagName ## _flag, Args)
|
||||||
|
|
||||||
|
|
||||||
/*----------------------.
|
/*----------------------.
|
||||||
@@ -241,14 +241,14 @@ static const char * const warnings_args[] =
|
|||||||
|
|
||||||
static const int warnings_types[] =
|
static const int warnings_types[] =
|
||||||
{
|
{
|
||||||
warnings_none,
|
Wnone,
|
||||||
warnings_midrule_values,
|
Wmidrule_values,
|
||||||
warnings_yacc,
|
Wyacc,
|
||||||
warnings_conflicts_sr,
|
Wconflicts_sr,
|
||||||
warnings_conflicts_rr,
|
Wconflicts_rr,
|
||||||
warnings_other,
|
Wother,
|
||||||
warnings_all,
|
Wall,
|
||||||
warnings_error
|
Werror
|
||||||
};
|
};
|
||||||
|
|
||||||
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
||||||
@@ -584,7 +584,7 @@ getargs (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
FLAGS_ARGMATCH (trace, optarg);
|
FLAGS_ARGMATCH (trace, optarg, trace_all);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
@@ -592,7 +592,7 @@ getargs (int argc, char *argv[])
|
|||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
case 'W':
|
case 'W':
|
||||||
FLAGS_ARGMATCH (warnings, optarg);
|
FLAGS_ARGMATCH (warnings, optarg, Wall);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
@@ -638,7 +638,7 @@ getargs (int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
FLAGS_ARGMATCH (report, optarg);
|
FLAGS_ARGMATCH (report, optarg, report_all);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
|
|||||||
@@ -114,14 +114,14 @@ extern int trace_flag;
|
|||||||
|
|
||||||
enum warnings
|
enum warnings
|
||||||
{
|
{
|
||||||
warnings_none = 0, /**< Issue no warnings. */
|
Wnone = 0, /**< Issue no warnings. */
|
||||||
warnings_error = 1 << 0, /**< Warnings are treated as errors. */
|
Werror = 1 << 0, /**< Warnings are treated as errors. */
|
||||||
warnings_midrule_values = 1 << 1, /**< Unset or unused midrule values. */
|
Wmidrule_values = 1 << 1, /**< Unset or unused midrule values. */
|
||||||
warnings_yacc = 1 << 2, /**< POSIXME. */
|
Wyacc = 1 << 2, /**< POSIXME. */
|
||||||
warnings_conflicts_sr = 1 << 3, /**< S/R conflicts. */
|
Wconflicts_sr = 1 << 3, /**< S/R conflicts. */
|
||||||
warnings_conflicts_rr = 1 << 4, /**< R/R conflicts. */
|
Wconflicts_rr = 1 << 4, /**< R/R conflicts. */
|
||||||
warnings_other = 1 << 5, /**< All other warnings. */
|
Wother = 1 << 5, /**< All other warnings. */
|
||||||
warnings_all = ~warnings_error /**< All above warnings. */
|
Wall = ~Werror /**< All above warnings. */
|
||||||
};
|
};
|
||||||
/** What warnings are issued. */
|
/** What warnings are issued. */
|
||||||
extern int warnings_flag;
|
extern int warnings_flag;
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ grammar_rules_useless_report (const char *message)
|
|||||||
if (!rules[r].useful)
|
if (!rules[r].useful)
|
||||||
{
|
{
|
||||||
warn_at (rules[r].location, "%s: ", message);
|
warn_at (rules[r].location, "%s: ", message);
|
||||||
if (warnings_flag & warnings_other)
|
if (warnings_flag & Wother)
|
||||||
{
|
{
|
||||||
rule_print (&rules[r], stderr);
|
rule_print (&rules[r], stderr);
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
|
|||||||
Reference in New Issue
Block a user