]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: ignore -Wregister instead of -Wdeprecated-register
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 8 Apr 2024 02:57:19 +0000 (22:57 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 8 Apr 2024 02:57:39 +0000 (22:57 -0400)
When building GDB on Centos 7 (which has flex 2.5.37) and Clang, I get:

    $ make ada-exp.o
      YACC   ada-exp.c
      LEX    ada-lex.c
      CXX    ada-exp.o
    In file included from /home/smarchi/src/binutils-gdb/gdb/ada-exp.y:1179:
    <stdout>:1106:2: error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
     1106 |         register yy_state_type yy_current_state;
          |         ^~~~~~~~

In ada-lex.l, we already use `DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER`,
which for Clang translates to ignoring `-Wdeprecated-register` [1].  I think
that was produced when compiling as C++11, but now that we always compile as
C++17, Clang produces a `-Wregister` error [2].

For GCC, `DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER` already translates to
ignoring `-Wregister`.  So, rename
`DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER` to `DIAGNOSTIC_IGNORE_REGISTER`
and ignore `-Wregister` for Clang too.

[1] https://releases.llvm.org/17.0.1/tools/clang/docs/DiagnosticsReference.html#wdeprecated-register
[2] https://releases.llvm.org/17.0.1/tools/clang/docs/DiagnosticsReference.html#wregister

include/ChangeLog:

* diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Rename
to...
(DIAGNOSTIC_IGNORE_REGISTER): ... this.  Ignore `-Wregister`
instead of `-Wdeprecated-register`.

Change-Id: I8a4a51c7222c68577fa22ecacdddfcba32d9dbc5

gdb/ada-lex.l
include/ChangeLog
include/diagnostics.h

index 1b1aaf8900531ec8f23e9290b0be3a2d885d749a..136e6dd3c2c1ae9d75c544621165ad15894e6aab 100644 (file)
@@ -48,13 +48,11 @@ NOT_COMPLETE [^\001]
 
 #include "diagnostics.h"
 
-/* Some old versions of flex generate code that uses the "register" keyword,
-   which clang warns about.  This was observed for example with flex 2.5.35,
-   as shipped with macOS 10.12.  The same happens with flex 2.5.37 and g++ 11
-   which defaults to ISO C++17, that does not allow register storage class
-   specifiers.  */
+/* Some old versions of flex (2.5.x) generate code that uses the "register"
+   keyword, which compilers warn about, because it is not allowed in ISO
+   C++17.  */
 DIAGNOSTIC_PUSH
-DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
+DIAGNOSTIC_IGNORE_REGISTER
 
 #define NUMERAL_WIDTH 256
 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
index db5c258cbdfd8e9519a020061c33df07354aa153..bf4aa1d67f6fbb1ece88bd54ce2c8b22039418f5 100644 (file)
@@ -1,3 +1,10 @@
+2024-04-07  Simon Marchi  <simon.marchi@efficios.com>
+
+       * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Rename
+       to...
+       (DIAGNOSTIC_IGNORE_REGISTER): ... this.  Ignore `-Wregister`
+       instead of `-Wdeprecated-register`.
+
 2024-02-14  Yuriy Kolerov  <ykolerov@synopsys.com>
 
        * opcode/arc.h (enum insn_class_t): Add DBNZ class.
index 8cc2b493d2c02ba7dbc5879207746107ad7143a0..97e30ab807f477d15ebbf277e0a85c8dbd712b9c 100644 (file)
@@ -53,8 +53,8 @@
 # define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move")
 # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS \
   DIAGNOSTIC_IGNORE ("-Wdeprecated-declarations")
-# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
-  DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
+# define DIAGNOSTIC_IGNORE_REGISTER DIAGNOSTIC_IGNORE ("-Wregister")
+
 # if __has_warning ("-Wenum-compare-switch")
 #  define DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES \
    DIAGNOSTIC_IGNORE ("-Wenum-compare-switch")
@@ -87,8 +87,7 @@
   DIAGNOSTIC_IGNORE ("-Wdeprecated-declarations")
 
 # if __GNUC__ >= 7
-#  define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
-   DIAGNOSTIC_IGNORE ("-Wregister")
+#  define DIAGNOSTIC_IGNORE_REGISTER DIAGNOSTIC_IGNORE ("-Wregister")
 # endif
 
 # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
 # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS
 #endif
 
-#ifndef DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
-# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
+#ifndef DIAGNOSTIC_IGNORE_REGISTER
+# define DIAGNOSTIC_IGNORE_REGISTER
 #endif
 
 #ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES