[binutils-gdb] ada-lex.l: Ignore register diagnostic also for g++ defaulting to ISO C++17

Mark Wielaard mark@sourceware.org
Sun Aug 23 10:24:05 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b8fff44e0e2e43e1823413eec7c5f6fa9d219ce7

commit b8fff44e0e2e43e1823413eec7c5f6fa9d219ce7
Author: Mark Wielaard <mark@klomp.org>
Date:   Sat Aug 22 00:20:55 2020 +0200

    ada-lex.l: Ignore register diagnostic also for g++ defaulting to ISO C++17
    
    Building with a really old flex and a really new g++ is probably not
    recommended, but it should not cause compile errors.
    
    gdb/ChangeLog:
    
            * ada-lex.l: Extend register warnings diagnostics comment for g++.
    
    include/ChangeLog:
    
            * diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Also define
            for GCC version 7.0 or higher.

Diff:
---
 gdb/ChangeLog         | 4 ++++
 gdb/ada-lex.l         | 4 +++-
 include/ChangeLog     | 5 +++++
 include/diagnostics.h | 5 +++++
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2e0534e2a60..a01a97fc1cb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-08-21  Mark Wielaard  <mark@klomp.org>
+
+	* ada-lex.l: Extend register warnings diagnostics comment for g++.
+
 2020-08-22  Simon Marchi  <simon.marchi@efficios.com>
 
 	* frame.c (enum class frame_id_status): New.
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 1e4bc20f77c..edf28801944 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -45,7 +45,9 @@ POSEXP  (e"+"?{NUM10})
 
 /* 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.  */
+   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.  */
 DIAGNOSTIC_PUSH
 DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
 
diff --git a/include/ChangeLog b/include/ChangeLog
index d0475de1ce9..53597cf0650 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,8 @@
+2020-08-21  Mark Wielaard  <mark@klomp.org>
+
+	* diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER): Also define
+	for GCC 7.0 or higher.
+
 2020-08-10  Alex Coplan  <alex.coplan@arm.com>
 
 	* opcode/aarch64.h (AARCH64_MAX_SYSREG_NAME_LEN): New.
diff --git a/include/diagnostics.h b/include/diagnostics.h
index 82d871b5b2a..0f0a33c1a1e 100644
--- a/include/diagnostics.h
+++ b/include/diagnostics.h
@@ -63,6 +63,11 @@
 
 #elif defined (__GNUC__) /* GCC */
 
+# if __GNUC__ >= 7
+#  define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
+   DIAGNOSTIC_IGNORE ("-Wregister")
+# endif
+
 # define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
   DIAGNOSTIC_IGNORE ("-Wstringop-truncation")


More information about the Gdb-cvs mailing list