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:
Akim Demaille
2012-08-20 09:29:05 +02:00
parent 31557b9ead
commit 518e88308f
7 changed files with 55 additions and 40 deletions

6
NEWS
View File

@@ -13,6 +13,12 @@ GNU Bison NEWS
** 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
For instance:

View File

@@ -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
no effect on the conflict report.
@item deprecated
Deprecated constructs whose support will be removed in future versions of
Bison.
@item other
All warnings not categorized above. These warnings are enabled by default.

View File

@@ -29,7 +29,8 @@
#include "files.h"
#include "getargs.h"
warnings warnings_flag = Wconflicts_sr | Wconflicts_rr | Wother;
warnings warnings_flag =
Wconflicts_sr | Wconflicts_rr | Wdeprecated | Wother;
bool complaint_issued;
static unsigned *indent_ptr = 0;
@@ -45,6 +46,7 @@ warnings_print_categories (warnings warn_flags)
"yacc",
"conflicts-sr",
"conflicts-rr",
"deprecated",
"other"
};

View File

@@ -32,7 +32,8 @@ typedef enum
Wyacc = 1 << 1, /**< POSIXME. */
Wconflicts_sr = 1 << 2, /**< S/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. */
complaint = 1 << 11, /**< All complaints. */

View File

@@ -218,6 +218,7 @@ static const char * const warnings_args[] =
"yacc - incompatibilities with POSIX Yacc",
"conflicts-sr - S/R conflicts",
"conflicts-rr - R/R conflicts",
"deprecated - obsolete constructs",
"other - all other warnings",
"all - all of the above",
"error - warnings are errors",
@@ -231,6 +232,7 @@ static const int warnings_types[] =
Wyacc,
Wconflicts_sr,
Wconflicts_rr,
Wdeprecated,
Wother,
Wall,
Werror

View File

@@ -225,9 +225,9 @@ ref -?[0-9]+|{id}|"["{id}"]"|"$"
if (outer_brace && !yacc_flag && language_prio == default_prio
&& 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"));
complain_at (*loc, Wother,
complain_at (*loc, Wdeprecated,
_("future versions of Bison will not add the ';'"));
obstack_1grow (&obstack_for_string, ';');
}

View File

@@ -1438,42 +1438,42 @@ string;"}
AT_BISON_OPTION_POPDEFS
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: future versions of Bison will not add the ';' [-Wother]
input.y:9.48: warning: a ';' might be needed at the end of action code [-Wother]
input.y:9.48: warning: future versions of Bison will not add the ';' [-Wother]
input.y:10.48: warning: a ';' might be needed at the end of action code [-Wother]
input.y:10.48: warning: future versions of Bison will not add the ';' [-Wother]
input.y:11.48: warning: a ';' might be needed at the end of action code [-Wother]
input.y:11.48: warning: future versions of Bison will not add the ';' [-Wother]
input.y:12.48: warning: a ';' might be needed at the end of action code [-Wother]
input.y:12.48: warning: future versions of Bison will not add the ';' [-Wother]
input.y:13.48: warning: a ';' might be needed at the end of action code [-Wother]
input.y:13.48: warning: future versions of Bison will not add the ';' [-Wother]
input.y:20.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:20.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:21.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:21.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:22.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:22.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:23.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:23.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:24.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:24.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:25.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:25.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:31.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:31.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:32.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:32.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:33.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:33.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:34.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:34.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:35.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:35.1: warning: future versions of Bison will not add the ';' [-Wother]
input.y:36.1: warning: a ';' might be needed at the end of action code [-Wother]
input.y:36.1: warning: future versions of Bison will not add the ';' [-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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
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 ';' [-Wdeprecated]
]])
AT_MATCHES_CHECK([input.c], [[/\* TEST:N:2 \*/ \}$]], [[3]])