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:
Victor Santet
2012-06-28 16:44:19 +02:00
committed by Akim Demaille
parent f124616490
commit 327db05b22
6 changed files with 36 additions and 36 deletions

View File

@@ -100,7 +100,7 @@ void
set_warning_issued (void)
{
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);
complaint_issued = true;
@@ -111,7 +111,7 @@ set_warning_issued (void)
void
warn_at (location loc, const char *message, ...)
{
if (!(warnings_flag & warnings_other))
if (!(warnings_flag & Wother))
return;
set_warning_issued ();
ERROR_MESSAGE (&loc, _("warning"), message);
@@ -121,7 +121,7 @@ void
warn_at_indent (location loc, unsigned *indent,
const char *message, ...)
{
if (!(warnings_flag & warnings_other))
if (!(warnings_flag & Wother))
return;
set_warning_issued ();
indent_ptr = indent;
@@ -131,7 +131,7 @@ warn_at_indent (location loc, unsigned *indent,
void
warn (const char *message, ...)
{
if (!(warnings_flag & warnings_other))
if (!(warnings_flag & Wother))
return;
set_warning_issued ();
ERROR_MESSAGE (NULL, _("warning"), message);
@@ -179,7 +179,7 @@ yacc_at (location loc, const char *message, ...)
ERROR_MESSAGE (&loc, NULL, message);
complaint_issued = true;
}
else if (warnings_flag & warnings_yacc)
else if (warnings_flag & Wyacc)
{
set_warning_issued ();
ERROR_MESSAGE (&loc, _("warning"), message);
@@ -189,7 +189,7 @@ yacc_at (location loc, const char *message, ...)
void
midrule_value_at (location loc, const char *message, ...)
{
if (!(warnings_flag & warnings_midrule_values))
if (!(warnings_flag & Wmidrule_values))
return;
set_warning_issued ();
ERROR_MESSAGE (&loc, _("warning"), message);

View File

@@ -26,14 +26,14 @@ extern "C" {
# endif
/** 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. */
void set_warning_issued (void);
/** Informative messages, but we proceed. Report iff
<tt>warnings_flag & warnings_other</tt>. */
<tt>warnings_flag & Wother</tt>. */
void warn (char const *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
@@ -70,7 +70,7 @@ void yacc_at (location loc, char const *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
/** 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, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));

View File

@@ -601,9 +601,9 @@ conflicts_print (void)
/* Report the total number of conflicts on STDERR. */
if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
{
if (!(warnings_flag & warnings_conflicts_sr))
if (!(warnings_flag & Wconflicts_sr))
src_total = 0;
if (!(warnings_flag & warnings_conflicts_rr))
if (!(warnings_flag & Wconflicts_rr))
rrc_total = 0;
}
if (src_total | rrc_total)

View File

@@ -61,8 +61,8 @@ bool glr_parser = false;
int report_flag = report_none;
int trace_flag = trace_none;
int warnings_flag = warnings_conflicts_sr | warnings_conflicts_rr
| warnings_other;
int warnings_flag = Wconflicts_sr | Wconflicts_rr
| Wother;
static struct bison_language const valid_languages[] = {
{ "c", "c-skel.m4", ".c", ".h", true },
@@ -129,15 +129,15 @@ flags_argmatch (const char *option,
*
* \param FlagName the flag familly to update.
* \param Args the effective sub arguments to decode.
* \param All the "all" value.
*
* \arg FlagName_args the list of keys.
* \arg FlagName_types the list of values.
* \arg FlagName_all the all value.
* \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, \
FlagName ## _all, &FlagName ## _flag, Args)
All, &FlagName ## _flag, Args)
/*----------------------.
@@ -241,14 +241,14 @@ static const char * const warnings_args[] =
static const int warnings_types[] =
{
warnings_none,
warnings_midrule_values,
warnings_yacc,
warnings_conflicts_sr,
warnings_conflicts_rr,
warnings_other,
warnings_all,
warnings_error
Wnone,
Wmidrule_values,
Wyacc,
Wconflicts_sr,
Wconflicts_rr,
Wother,
Wall,
Werror
};
ARGMATCH_VERIFY (warnings_args, warnings_types);
@@ -584,7 +584,7 @@ getargs (int argc, char *argv[])
break;
case 'T':
FLAGS_ARGMATCH (trace, optarg);
FLAGS_ARGMATCH (trace, optarg, trace_all);
break;
case 'V':
@@ -592,7 +592,7 @@ getargs (int argc, char *argv[])
exit (EXIT_SUCCESS);
case 'W':
FLAGS_ARGMATCH (warnings, optarg);
FLAGS_ARGMATCH (warnings, optarg, Wall);
break;
case 'b':
@@ -638,7 +638,7 @@ getargs (int argc, char *argv[])
break;
case 'r':
FLAGS_ARGMATCH (report, optarg);
FLAGS_ARGMATCH (report, optarg, report_all);
break;
case 't':

View File

@@ -114,14 +114,14 @@ extern int trace_flag;
enum warnings
{
warnings_none = 0, /**< Issue no warnings. */
warnings_error = 1 << 0, /**< Warnings are treated as errors. */
warnings_midrule_values = 1 << 1, /**< Unset or unused midrule values. */
warnings_yacc = 1 << 2, /**< POSIXME. */
warnings_conflicts_sr = 1 << 3, /**< S/R conflicts. */
warnings_conflicts_rr = 1 << 4, /**< R/R conflicts. */
warnings_other = 1 << 5, /**< All other warnings. */
warnings_all = ~warnings_error /**< All above warnings. */
Wnone = 0, /**< Issue no warnings. */
Werror = 1 << 0, /**< Warnings are treated as errors. */
Wmidrule_values = 1 << 1, /**< Unset or unused midrule values. */
Wyacc = 1 << 2, /**< POSIXME. */
Wconflicts_sr = 1 << 3, /**< S/R conflicts. */
Wconflicts_rr = 1 << 4, /**< R/R conflicts. */
Wother = 1 << 5, /**< All other warnings. */
Wall = ~Werror /**< All above warnings. */
};
/** What warnings are issued. */
extern int warnings_flag;

View File

@@ -309,7 +309,7 @@ grammar_rules_useless_report (const char *message)
if (!rules[r].useful)
{
warn_at (rules[r].location, "%s: ", message);
if (warnings_flag & warnings_other)
if (warnings_flag & Wother)
{
rule_print (&rules[r], stderr);
fflush (stderr);