diff options
author | Victor Santet <victor.santet@epita.fr> | 2012-06-29 15:22:09 +0200 |
---|---|---|
committer | Akim Demaille <akim@lrde.epita.fr> | 2012-06-29 16:34:22 +0200 |
commit | b6403170609485abe21038a65255ae4d3825ec00 (patch) | |
tree | 44803578224f4535049acb298a86bc10fa2a8f28 /src/complain.c | |
parent | 3e153163c7349c09938376f181ea4d8a1a02cdb5 (diff) | |
download | bison-b6403170609485abe21038a65255ae4d3825ec00.tar.gz |
warnings: be ready to print warnings categories
A function to print warnings categories, like -Wyacc, -Wother, etc.
* src/complain.h, src/complain.c (print_warning_categories): New function.
* src/output.c (ARRAY_CARDINALITY): Move it to file 'src/system.h'.
* src/complain.h (enum warnings): New value, 'silent', "complain"
must not display the warning type.
Diffstat (limited to 'src/complain.c')
-rw-r--r-- | src/complain.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/complain.c b/src/complain.c index a84718be..0f00358a 100644 --- a/src/complain.c +++ b/src/complain.c @@ -34,7 +34,32 @@ warnings warnings_flag = Wconflicts_sr | Wconflicts_rr | Wother; bool complaint_issued; static unsigned *indent_ptr = 0; - +void +warnings_print_categories (warnings warn_flags) +{ + if (! (warn_flags & silent)) + { + char const *warn_names[] = + { + "midrule-values", + "yacc", + "conflicts-sr", + "conflicts-rr", + "other" + }; + + bool any = false; + int i; + for (i = 0; i < ARRAY_CARDINALITY (warn_names); ++i) + if (warn_flags & 1 << i) + { + fprintf (stderr, "%s-W%s", any ? ", " : " [", warn_names[i]); + any = true; + } + if (any) + fprintf (stderr, "]"); + } +} /** Report an error message. * |