From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id D7D813858D28; Mon, 8 Apr 2024 02:58:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7D813858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1712545124; bh=0cYuY6j44wJuX+hULptJK2wVkMJVZYOAYDr8klQNvbI=; h=From:To:Subject:Date:From; b=JP6caJbNQaDuJ6Y/W2inYsDEK4onBt4NrzWyPaQY7KyrUOvh16Sd0sLLZOoo6Q0XG JEadG+A0EL+LLJlUFjYV4WVf/PGPrsFlPoeE0nDUsfV6EaD0t7UvJUb9yHJjhh2o36 GS5ylt/nuQLYgQC+5zPODJbOnKhCxSGTQoiFIpMs= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: binutils-cvs@sourceware.org, gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: ignore -Wregister instead of -Wdeprecated-register X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 248b6326a49ed49e2f627d3bddbac514a074bac0 X-Git-Newrev: ecc3c386677c2c096b2d589588dd26d21a0fb476 Message-Id: <20240408025844.D7D813858D28@sourceware.org> Date: Mon, 8 Apr 2024 02:58:44 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Decc3c386677c= 2c096b2d589588dd26d21a0fb476 commit ecc3c386677c2c096b2d589588dd26d21a0fb476 Author: Simon Marchi Date: Sun Apr 7 22:57:19 2024 -0400 gdb: ignore -Wregister instead of -Wdeprecated-register =20 When building GDB on Centos 7 (which has flex 2.5.37) and Clang, I get: =20 $ 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: :1106:2: error: ISO C++17 does not allow 'register' storage= class specifier [-Wregister] 1106 | register yy_state_type yy_current_state; | ^~~~~~~~ =20 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 compi= le as C++17, Clang produces a `-Wregister` error [2]. =20 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. =20 [1] https://releases.llvm.org/17.0.1/tools/clang/docs/DiagnosticsRefere= nce.html#wdeprecated-register [2] https://releases.llvm.org/17.0.1/tools/clang/docs/DiagnosticsRefere= nce.html#wregister =20 include/ChangeLog: =20 * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Rename to... (DIAGNOSTIC_IGNORE_REGISTER): ... this. Ignore `-Wregister` instead of `-Wdeprecated-register`. =20 Change-Id: I8a4a51c7222c68577fa22ecacdddfcba32d9dbc5 Diff: --- gdb/ada-lex.l | 10 ++++------ include/ChangeLog | 7 +++++++ include/diagnostics.h | 11 +++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l index 1b1aaf89005..136e6dd3c2c 100644 --- a/gdb/ada-lex.l +++ b/gdb/ada-lex.l @@ -48,13 +48,11 @@ NOT_COMPLETE [^\001] =20 #include "diagnostics.h" =20 -/* Some old versions of flex generate code that uses the "register" keywor= d, - which clang warns about. This was observed for example with flex 2.5.3= 5, - 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 =20 #define NUMERAL_WIDTH 256 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1= )) diff --git a/include/ChangeLog b/include/ChangeLog index db5c258cbdf..bf4aa1d67f6 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2024-04-07 Simon Marchi + + * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Rename + to... + (DIAGNOSTIC_IGNORE_REGISTER): ... this. Ignore `-Wregister` + instead of `-Wdeprecated-register`. + 2024-02-14 Yuriy Kolerov =20 * opcode/arc.h (enum insn_class_t): Add DBNZ class. diff --git a/include/diagnostics.h b/include/diagnostics.h index 8cc2b493d2c..97e30ab807f 100644 --- a/include/diagnostics.h +++ b/include/diagnostics.h @@ -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") =20 # if __GNUC__ >=3D 7 -# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \ - DIAGNOSTIC_IGNORE ("-Wregister") +# define DIAGNOSTIC_IGNORE_REGISTER DIAGNOSTIC_IGNORE ("-Wregister") # endif =20 # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \ @@ -128,8 +127,8 @@ # define DIAGNOSTIC_IGNORE_DEPRECATED_DECLARATIONS #endif =20 -#ifndef DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER -# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER +#ifndef DIAGNOSTIC_IGNORE_REGISTER +# define DIAGNOSTIC_IGNORE_REGISTER #endif =20 #ifndef DIAGNOSTIC_IGNORE_SWITCH_DIFFERENT_ENUM_TYPES