summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f124616)
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.
set_warning_issued (void)
{
static bool warning_issued = false;
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;
{
fprintf (stderr, "%s: warnings being treated as errors\n", program_name);
complaint_issued = true;
void
warn_at (location loc, const char *message, ...)
{
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);
return;
set_warning_issued ();
ERROR_MESSAGE (&loc, _("warning"), message);
warn_at_indent (location loc, unsigned *indent,
const char *message, ...)
{
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;
return;
set_warning_issued ();
indent_ptr = indent;
void
warn (const char *message, ...)
{
void
warn (const char *message, ...)
{
- if (!(warnings_flag & warnings_other))
+ if (!(warnings_flag & Wother))
return;
set_warning_issued ();
ERROR_MESSAGE (NULL, _("warning"), message);
return;
set_warning_issued ();
ERROR_MESSAGE (NULL, _("warning"), message);
ERROR_MESSAGE (&loc, NULL, message);
complaint_issued = true;
}
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);
{
set_warning_issued ();
ERROR_MESSAGE (&loc, _("warning"), message);
void
midrule_value_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);
return;
set_warning_issued ();
ERROR_MESSAGE (&loc, _("warning"), message);
# endif
/** Record that a warning is about to be issued, and treat it as an
# 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
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)));
void warn (char const *format, ...)
__attribute__ ((__format__ (__printf__, 1, 2)));
__attribute__ ((__format__ (__printf__, 2, 3)));
/** A midrule-value warning. Report iff
__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)));
void midrule_value_at (location loc, char const *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
/* Report the total number of conflicts on STDERR. */
if (expected_sr_conflicts == -1 && expected_rr_conflicts == -1)
{
/* 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))
- if (!(warnings_flag & warnings_conflicts_rr))
+ if (!(warnings_flag & Wconflicts_rr))
rrc_total = 0;
}
if (src_total | rrc_total)
rrc_total = 0;
}
if (src_total | rrc_total)
int report_flag = report_none;
int trace_flag = trace_none;
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 },
static struct bison_language const valid_languages[] = {
{ "c", "c-skel.m4", ".c", ".h", true },
*
* \param FlagName the flag familly to update.
* \param Args the effective sub arguments to decode.
*
* \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_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.
*/
* \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)
/*----------------------.
/*----------------------.
static const int warnings_types[] =
{
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);
};
ARGMATCH_VERIFY (warnings_args, warnings_types);
- FLAGS_ARGMATCH (trace, optarg);
+ FLAGS_ARGMATCH (trace, optarg, trace_all);
exit (EXIT_SUCCESS);
case 'W':
exit (EXIT_SUCCESS);
case 'W':
- FLAGS_ARGMATCH (warnings, optarg);
+ FLAGS_ARGMATCH (warnings, optarg, Wall);
- FLAGS_ARGMATCH (report, optarg);
+ FLAGS_ARGMATCH (report, optarg, report_all);
- 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;
};
/** What warnings are issued. */
extern int warnings_flag;
if (!rules[r].useful)
{
warn_at (rules[r].location, "%s: ", 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);
{
rule_print (&rules[r], stderr);
fflush (stderr);