err_status complaint_status = status_none;
static unsigned *indent_ptr = 0;
-void
-warnings_print_categories (warnings warn_flags)
+/** Display a "[-Wyacc]" like message on \a f. */
+
+static void
+warnings_print_categories (warnings warn_flags, FILE *f)
{
- if (! (warn_flags & silent))
- {
- char const *warn_names[] =
- {
- "midrule-values",
- "yacc",
- "conflicts-sr",
- "conflicts-rr",
- "deprecated",
- "precedence",
- "other"
- };
-
- bool any = false;
- int i;
- for (i = 0; i < ARRAY_CARDINALITY (warn_names); ++i)
- if (warn_flags & 1 << i)
- {
- bool err = warn_flags & errors_flag;
- fprintf (stderr, "%s-W", any ? ", " : " [");
- fprintf (stderr, "%s%s", err ? "error=" : "" , warn_names[i]);
- any = true;
- }
- if (any)
- fprintf (stderr, "]");
- }
+ /* Display only the first match, the second is "-Wall". */
+ int i;
+ for (i = 0; warnings_args[i]; ++i)
+ if (warn_flags & warnings_types[i])
+ {
+ bool err = warn_flags & errors_flag;
+ fprintf (f, " [-W%s%s]", err ? "error=" : "" , warnings_args[i]);
+ break;
+ }
}
/** Report an error message.
fprintf (stderr, "%s: ", prefix);
vfprintf (stderr, message, args);
- warnings_print_categories (flags);
+ if (! (flags & silent))
+ warnings_print_categories (flags, stderr);
{
size_t l = strlen (message);
if (l < 2 || message[l - 2] != ':' || message[l - 1] != ' ')
/** What warnings are made errors. */
extern warnings errors_flag;
-/** Display a "[-Wyacc]" like message on stderr. */
-void warnings_print_categories (warnings warn_flags);
-
/** Make a complaint, with maybe a location. */
void complain (location const *loc, warnings flags, char const *message, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
| --warnings's handling. |
`------------------------*/
-static const char * const warnings_args[] =
+const char * const warnings_args[] =
{
"none",
"midrule-values",
0
};
-static const int warnings_types[] =
+const int warnings_types[] =
{
Wnone,
Wmidrule_values,
/** What additional features to use. */
extern int feature_flag;
+/*------------.
+| --warning. |
+`------------*/
+/* Null-terminated list. */
+extern const char * const warnings_args[];
+extern const int warnings_types[];
+
+
/** Process the command line arguments.
*
* \param argc size of \a argv
quote (*variablep), quote_n (1, value));
i += SUB_INDENT;
for (values = variablep + 1; *values; ++values)
- complain_indent (&loc, complaint | no_caret, &i,
+ complain_indent (&loc, complaint | no_caret | silent, &i,
_("accepted value: %s"), quote (*values));
}
else