errors: change output, and improve -y coherence

The prefix of warnings treated as errors is now "error: ". Also, their
suffix now reflects the changes in the Werror option format.

An output for -Werror=other used to be:
  bison: warnings being treated as errors
  input.y:1.1: warning: stray ',' treated as white space [-Wother]

It is now:
  bison: warnings being treated as errors
  input.y:1.1: error: stray ',' treated as white space [-Werror=other]

The line "warnings being treated as errors" no longer adds any info,
it will be removed in a forthcoming change.

* NEWS: Add entry "Enhancement of the -Werror"
* doc/bison.texi: Move the warnings-as-error to a new bullet.
* src/complain.c (complains): Refactor, change the prefix of warnings
that are treated as errors.
(warnings_print_categories): Support for [-Werror=CATEGORY] display
* src/getargc.c (getargs): -y implies -Werror=yacc
* tests/input.at: Update expected --yacc output for coherence.

Signed-off-by: Akim Demaille <akim@lrde.epita.fr>
This commit is contained in:
Akim Demaille
2012-09-27 12:19:09 +02:00
parent 9503b0a4a8
commit 1048a1c901
6 changed files with 100 additions and 41 deletions

View File

@@ -87,7 +87,7 @@ flags_argmatch (const char *option,
args = strtok (args, ",");
while (args)
{
int value = all;
int value = 0;
int *save_flags = flags;
int no = STRPREFIX_LIT ("no-", args) ? 3 : 0;
int err = STRPREFIX_LIT ("error", args + no) ? 5 : 0;
@@ -99,7 +99,12 @@ flags_argmatch (const char *option,
if (!value)
{
if (no)
/* With a simpler 'if (no)' version, -Werror means -Werror=all
(or rather, -Werror=no-none, but that syntax is invalid).
The difference is:
- Werror activates all errors, but not the warnings
- Werror=all activates errors, and all warnings */
if (no ? !err : err)
*flags |= all;
else
*flags &= ~all;
@@ -681,6 +686,8 @@ getargs (int argc, char *argv[])
break;
case 'y':
warnings_flag |= Wyacc;
errors_flag |= Wyacc;
yacc_flag = true;
break;