bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] introduce -Wdeprecated


From: Akim Demaille
Subject: [PATCH 2/4] introduce -Wdeprecated
Date: Tue, 4 Sep 2012 13:58:14 +0200

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.
---
 NEWS             |  6 +++++
 doc/bison.texi   |  4 ++++
 src/complain.c   |  4 +++-
 src/complain.h   |  3 ++-
 src/getargs.c    |  2 ++
 src/scan-code.l  |  4 ++--
 tests/actions.at | 72 ++++++++++++++++++++++++++++----------------------------
 7 files changed, 55 insertions(+), 40 deletions(-)

diff --git a/NEWS b/NEWS
index 0368c0e..74afbfa 100644
--- a/NEWS
+++ b/NEWS
@@ -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:
diff --git a/doc/bison.texi b/doc/bison.texi
index 0a0ae01..1297a36 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -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.
 
address@hidden 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.
 
diff --git a/src/complain.c b/src/complain.c
index 7d905de..d79a250 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -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"
         };
 
diff --git a/src/complain.h b/src/complain.h
index 276164c..44be293 100644
--- a/src/complain.h
+++ b/src/complain.h
@@ -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.  */
diff --git a/src/getargs.c b/src/getargs.c
index 5a74f4b..d8a527d 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -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
diff --git a/src/scan-code.l b/src/scan-code.l
index 96cab6d..522c5b9 100644
--- a/src/scan-code.l
+++ b/src/scan-code.l
@@ -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, ';');
       }
diff --git a/tests/actions.at b/tests/actions.at
index c1af5ea..4b0019b 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -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]])
-- 
1.7.11.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]