This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] ada-lex: Ignore warnings about register keyword
- From: Simon Marchi <simark at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 26 Jun 2017 14:52:33 -0000
- Subject: [binutils-gdb] ada-lex: Ignore warnings about register keyword
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d1435379df189d1c358ebd9776af8824a9158533
commit d1435379df189d1c358ebd9776af8824a9158533
Author: Simon Marchi <simon.marchi@ericsson.com>
Date: Mon Jun 26 15:08:35 2017 +0200
ada-lex: Ignore warnings about register keyword
Some older versions of flex (such as the one shipped with macOS) generate
code that use the register keyword, which clang warns about. This patch
makes the compiler ignore those warnings for the portion of the code
generated by flex.
gdb/ChangeLog:
* common/diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER):
New macro.
* ada-lex.l: Ignore deprecated register warnings.
Diff:
---
gdb/ChangeLog | 6 ++++++
gdb/ada-lex.l | 10 ++++++++++
gdb/common/diagnostics.h | 3 +++
3 files changed, 19 insertions(+)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e1ad84a..5b04862 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-06-26 Simon Marchi <simon.marchi@ericsson.com>
+
+ * common/diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER):
+ New macro.
+ * ada-lex.l: Ignore deprecated register warnings.
+
2017-06-25 Simon Marchi <simon.marchi@ericsson.com>
* main.c (get_init_files): Replace "SYSTEM_GDBINIT +
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 0825290..fe97352 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -41,6 +41,14 @@ POSEXP (e"+"?{NUM10})
%{
+#include "common/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. */
+DIAGNOSTIC_PUSH
+DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
+
#define NUMERAL_WIDTH 256
#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
@@ -648,3 +656,5 @@ dummy_function ada_flex_use[] =
{
(dummy_function) yyunput
};
+
+DIAGNOSTIC_POP
diff --git a/gdb/common/diagnostics.h b/gdb/common/diagnostics.h
index 5a63bfd..35bacf2 100644
--- a/gdb/common/diagnostics.h
+++ b/gdb/common/diagnostics.h
@@ -33,8 +33,11 @@
#ifdef __clang__
# define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move")
+# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
+ DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
#else
# define DIAGNOSTIC_IGNORE_SELF_MOVE
+# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
#endif
#endif /* COMMON_DIAGNOSTICS_H */