mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
diagnostics: no longer include the yacc category in -Wall
It would be a pity to warn the users against Bison features... http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00107.html * src/complain.h, src/complain.c (Wall): Disable Wyacc. (Weverything): New (hidden so far) category which really denotes all the categories (what used to be Wall). (warnings_args, warnings_types): Adjust. (warning_argmatch): Now !none = Weverything and conversely, no longer Wall. * NEWS, doc/bison.texi, src/getargs.c: Adjust the documentation. * tests/input.at (-Werror is not affected by -Wnone and -Wall): Adjust by not using a -Wyacc type of warning.
This commit is contained in:
5
NEWS
5
NEWS
@@ -216,6 +216,11 @@ GNU Bison NEWS
|
|||||||
bar.y: error: shift/reduce conflicts: 1 found, 0 expected
|
bar.y: error: shift/reduce conflicts: 1 found, 0 expected
|
||||||
bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
|
bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
|
||||||
|
|
||||||
|
** Incompatibilities with POSIX Yacc
|
||||||
|
|
||||||
|
The 'yacc' category is no longer part of '-Wall', enable it explicitly
|
||||||
|
with '-Wyacc'.
|
||||||
|
|
||||||
** Additional yylex/yyparse arguments
|
** Additional yylex/yyparse arguments
|
||||||
|
|
||||||
The new directive %param declares additional arguments to both yylex and
|
The new directive %param declares additional arguments to both yylex and
|
||||||
|
|||||||
@@ -9853,9 +9853,11 @@ releases of Bison may move warnings from this category to new, more specific
|
|||||||
categories.
|
categories.
|
||||||
|
|
||||||
@item all
|
@item all
|
||||||
All the warnings.
|
All the warnings except @code{yacc}.
|
||||||
|
|
||||||
@item none
|
@item none
|
||||||
Turn off all the warnings.
|
Turn off all the warnings.
|
||||||
|
|
||||||
@item error
|
@item error
|
||||||
See @option{-Werror}, below.
|
See @option{-Werror}, below.
|
||||||
@end table
|
@end table
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ static const char * const warnings_args[] =
|
|||||||
"other",
|
"other",
|
||||||
"all",
|
"all",
|
||||||
"error",
|
"error",
|
||||||
|
"everything",
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +84,8 @@ static const int warnings_types[] =
|
|||||||
Wprecedence,
|
Wprecedence,
|
||||||
Wother,
|
Wother,
|
||||||
Wall,
|
Wall,
|
||||||
Werror
|
Werror,
|
||||||
|
Weverything
|
||||||
};
|
};
|
||||||
|
|
||||||
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
ARGMATCH_VERIFY (warnings_args, warnings_types);
|
||||||
@@ -94,10 +96,10 @@ warning_argmatch (char const *arg, size_t no, size_t err)
|
|||||||
int value = XARGMATCH ("--warning", arg + no + err,
|
int value = XARGMATCH ("--warning", arg + no + err,
|
||||||
warnings_args, warnings_types);
|
warnings_args, warnings_types);
|
||||||
|
|
||||||
/* -Wnone == -Wno-all, and -Wno-none == -Wall. */
|
/* -Wnone == -Wno-everything, and -Wno-none == -Weverything. */
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
value = Wall;
|
value = Weverything;
|
||||||
no = !no;
|
no = !no;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +147,7 @@ warnings_argmatch (char *args)
|
|||||||
else if (STREQ (args, "no-error"))
|
else if (STREQ (args, "no-error"))
|
||||||
{
|
{
|
||||||
warnings_are_errors = false;
|
warnings_are_errors = false;
|
||||||
warning_argmatch ("no-error=all", 3, 6);
|
warning_argmatch ("no-error=everything", 3, 6);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ typedef enum
|
|||||||
no_caret = 1 << 14, /**< Do not display caret location. */
|
no_caret = 1 << 14, /**< Do not display caret location. */
|
||||||
|
|
||||||
/**< All above warnings. */
|
/**< All above warnings. */
|
||||||
Wall = ~complaint & ~fatal & ~silent
|
Weverything = ~complaint & ~fatal & ~silent,
|
||||||
|
Wall = Weverything & ~Wyacc
|
||||||
} warnings;
|
} warnings;
|
||||||
|
|
||||||
/** Whether the warnings of \a flags are all unset.
|
/** Whether the warnings of \a flags are all unset.
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ Warning categories include:\n\
|
|||||||
'empty-rule' empty rules without %empty\n\
|
'empty-rule' empty rules without %empty\n\
|
||||||
'precedence' useless precedence and associativity\n\
|
'precedence' useless precedence and associativity\n\
|
||||||
'other' all other warnings (enabled by default)\n\
|
'other' all other warnings (enabled by default)\n\
|
||||||
'all' all the warnings\n\
|
'all' all the warnings except 'yacc'\n\
|
||||||
'no-CATEGORY' turn off warnings in CATEGORY\n\
|
'no-CATEGORY' turn off warnings in CATEGORY\n\
|
||||||
'none' turn off all the warnings\n\
|
'none' turn off all the warnings\n\
|
||||||
'error[=CATEGORY]' treat warnings as errors\n\
|
'error[=CATEGORY]' treat warnings as errors\n\
|
||||||
|
|||||||
@@ -1708,27 +1708,27 @@ AT_SETUP([[-Werror is not affected by -Wnone and -Wall]])
|
|||||||
|
|
||||||
AT_DATA([[input.y]],
|
AT_DATA([[input.y]],
|
||||||
[[%%
|
[[%%
|
||||||
foo-bar: %empty;
|
a: '0' { $$ = $; };
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# -Werror is not enabled by -Wall or equivalent.
|
# -Werror is not enabled by -Wall or equivalent.
|
||||||
AT_BISON_CHECK([[-Wall input.y]], [[0]], [[]],
|
AT_BISON_CHECK([[-Wall input.y]], [[0]], [[]],
|
||||||
[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wyacc]
|
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[-W input.y]], [[0]], [[]],
|
AT_BISON_CHECK([[-W input.y]], [[0]], [[]],
|
||||||
[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wyacc]
|
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||||
]])
|
]])
|
||||||
AT_BISON_CHECK([[-Wno-none input.y]], [[0]], [[]],
|
AT_BISON_CHECK([[-Wno-none input.y]], [[0]], [[]],
|
||||||
[[input.y:2.1-7: warning: POSIX Yacc forbids dashes in symbol names: foo-bar [-Wyacc]
|
[[input.y:2.15: warning: stray '$' [-Wother]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
# -Werror is not disabled by -Wnone or equivalent.
|
# -Werror is not disabled by -Wnone or equivalent.
|
||||||
AT_BISON_CHECK([[-Werror,none,yacc input.y]], [[1]], [[]], [[stderr]])
|
AT_BISON_CHECK([[-Werror,none,other input.y]], [[1]], [[]],
|
||||||
AT_CHECK([[sed 's/^.*bison:/bison:/' stderr]], [[0]],
|
[[input.y:2.15: error: stray '$' [-Werror=other]
|
||||||
[[input.y:2.1-7: error: POSIX Yacc forbids dashes in symbol names: foo-bar [-Werror=yacc]
|
]])
|
||||||
|
AT_BISON_CHECK([[-Werror,no-all,other input.y]], [[1]], [[]],
|
||||||
|
[[input.y:2.15: error: stray '$' [-Werror=other]
|
||||||
]])
|
]])
|
||||||
[mv stderr experr]
|
|
||||||
AT_BISON_CHECK([[-Werror,no-all,yacc input.y]], [[1]], [[]], [[experr]])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user