mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 10:13:03 +00:00
introduce -Wdeprecated
GCC seems to be using "deprecated" consistently over "obsoleted", so use -Wdeprecated rather than -Wobsolete. * src/complain.h (warnings): Add Wdeprecated. * src/complain.c (warnings_print_categories): Adjust. * src/getargs.c: Likewise. * doc/bison.texi: Document it. * src/scan-code.l: Use this category for the trailing ';' support. * tests/actions.at: Adjust expected output.
This commit is contained in:
6
NEWS
6
NEWS
@@ -13,6 +13,12 @@ GNU Bison NEWS
|
|||||||
|
|
||||||
** Warnings
|
** Warnings
|
||||||
|
|
||||||
|
*** Deprecated constructs
|
||||||
|
|
||||||
|
A new warning category, 'deprecated', is used to flag obsolete constructs
|
||||||
|
whose support will be discontinued. It is enabled by default. These
|
||||||
|
warnings used to be reported as 'other' warnings.
|
||||||
|
|
||||||
*** Warning categories are now displayed
|
*** Warning categories are now displayed
|
||||||
|
|
||||||
For instance:
|
For instance:
|
||||||
|
|||||||
@@ -9247,6 +9247,10 @@ unexpected number of conflicts is an error, and an expected number of
|
|||||||
conflicts is not reported, so @option{-W} and @option{--warning} then have
|
conflicts is not reported, so @option{-W} and @option{--warning} then have
|
||||||
no effect on the conflict report.
|
no effect on the conflict report.
|
||||||
|
|
||||||
|
@item deprecated
|
||||||
|
Deprecated constructs whose support will be removed in future versions of
|
||||||
|
Bison.
|
||||||
|
|
||||||
@item other
|
@item other
|
||||||
All warnings not categorized above. These warnings are enabled by default.
|
All warnings not categorized above. These warnings are enabled by default.
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@
|
|||||||
#include "files.h"
|
#include "files.h"
|
||||||
#include "getargs.h"
|
#include "getargs.h"
|
||||||
|
|
||||||
warnings warnings_flag = Wconflicts_sr | Wconflicts_rr | Wother;
|
warnings warnings_flag =
|
||||||
|
Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother;
|
||||||
|
|
||||||
bool complaint_issued;
|
bool complaint_issued;
|
||||||
static unsigned *indent_ptr = 0;
|
static unsigned *indent_ptr = 0;
|
||||||
@@ -45,6 +46,7 @@ warnings_print_categories (warnings warn_flags)
|
|||||||
"yacc",
|
"yacc",
|
||||||
"conflicts-sr",
|
"conflicts-sr",
|
||||||
"conflicts-rr",
|
"conflicts-rr",
|
||||||
|
"deprecated",
|
||||||
"other"
|
"other"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ typedef enum
|
|||||||
Wyacc = 1 << 1, /**< POSIXME. */
|
Wyacc = 1 << 1, /**< POSIXME. */
|
||||||
Wconflicts_sr = 1 << 2, /**< S/R conflicts. */
|
Wconflicts_sr = 1 << 2, /**< S/R conflicts. */
|
||||||
Wconflicts_rr = 1 << 3, /**< R/R conflicts. */
|
Wconflicts_rr = 1 << 3, /**< R/R conflicts. */
|
||||||
Wother = 1 << 4, /**< All other warnings. */
|
Wdeprecated = 1 << 4, /**< Obsolete constructs. */
|
||||||
|
Wother = 1 << 5, /**< All other warnings. */
|
||||||
|
|
||||||
Werror = 1 << 10, /**< Warnings are treated as errors. */
|
Werror = 1 << 10, /**< Warnings are treated as errors. */
|
||||||
complaint = 1 << 11, /**< All complaints. */
|
complaint = 1 << 11, /**< All complaints. */
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ static const char * const warnings_args[] =
|
|||||||
"yacc - incompatibilities with POSIX Yacc",
|
"yacc - incompatibilities with POSIX Yacc",
|
||||||
"conflicts-sr - S/R conflicts",
|
"conflicts-sr - S/R conflicts",
|
||||||
"conflicts-rr - R/R conflicts",
|
"conflicts-rr - R/R conflicts",
|
||||||
|
"deprecated - obsolete constructs",
|
||||||
"other - all other warnings",
|
"other - all other warnings",
|
||||||
"all - all of the above",
|
"all - all of the above",
|
||||||
"error - warnings are errors",
|
"error - warnings are errors",
|
||||||
@@ -231,6 +232,7 @@ static const int warnings_types[] =
|
|||||||
Wyacc,
|
Wyacc,
|
||||||
Wconflicts_sr,
|
Wconflicts_sr,
|
||||||
Wconflicts_rr,
|
Wconflicts_rr,
|
||||||
|
Wdeprecated,
|
||||||
Wother,
|
Wother,
|
||||||
Wall,
|
Wall,
|
||||||
Werror
|
Werror
|
||||||
|
|||||||
@@ -225,9 +225,9 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
|
|||||||
if (outer_brace && !yacc_flag && language_prio == default_prio
|
if (outer_brace && !yacc_flag && language_prio == default_prio
|
||||||
&& skeleton_prio == default_prio && need_semicolon && ! in_cpp)
|
&& skeleton_prio == default_prio && need_semicolon && ! in_cpp)
|
||||||
{
|
{
|
||||||
complain_at (*loc, Wother,
|
complain_at (*loc, Wdeprecated,
|
||||||
_("a ';' might be needed at the end of action code"));
|
_("a ';' might be needed at the end of action code"));
|
||||||
complain_at (*loc, Wother,
|
complain_at (*loc, Wdeprecated,
|
||||||
_("future versions of Bison will not add the ';'"));
|
_("future versions of Bison will not add the ';'"));
|
||||||
obstack_1grow (&obstack_for_string, ';');
|
obstack_1grow (&obstack_for_string, ';');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1438,42 +1438,42 @@ string;"}
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([[-o input.c input.y]], [0], [],
|
AT_BISON_CHECK([[-o input.c input.y]], [0], [],
|
||||||
[[input.y:8.48: warning: a ';' might be needed at the end of action code [-Wother]
|
[[input.y:8.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:8.48: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:8.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:9.48: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:9.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:9.48: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:9.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:10.48: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:10.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:10.48: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:10.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:11.48: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:11.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:11.48: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:11.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:12.48: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:12.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:12.48: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:12.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:13.48: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:13.48: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:13.48: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:13.48: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:20.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:20.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:20.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:20.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:21.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:21.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:21.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:21.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:22.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:22.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:22.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:22.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:23.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:23.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:23.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:23.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:24.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:24.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:24.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:24.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:25.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:25.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:25.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:25.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:31.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:31.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:31.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:31.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:32.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:32.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:32.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:32.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:33.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:33.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:33.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:33.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:34.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:34.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:34.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:34.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:35.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:35.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:35.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:35.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
input.y:36.1: warning: a ';' might be needed at the end of action code [-Wother]
|
input.y:36.1: warning: a ';' might be needed at the end of action code [-Wdeprecated]
|
||||||
input.y:36.1: warning: future versions of Bison will not add the ';' [-Wother]
|
input.y:36.1: warning: future versions of Bison will not add the ';' [-Wdeprecated]
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_MATCHES_CHECK([input.c], [[/\* TEST:N:2 \*/ \}$]], [[3]])
|
AT_MATCHES_CHECK([input.c], [[/\* TEST:N:2 \*/ \}$]], [[3]])
|
||||||
|
|||||||
Reference in New Issue
Block a user