summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-06-15 09:03:03 +0200
committerTom de Vries <tdevries@suse.de>2022-06-15 09:03:03 +0200
commitf1e14eee666ba5bf04b386d7ca69cf0f56992b06 (patch)
tree54280c18886f6e1da186b74df8498ea5da4dd1ad /include
parent31d6c13defeba7716ebc9d5c8f81f2f35fe39980 (diff)
[gdb/build] Fix build for gcc < 11
When building trunk on openSUSE Leap 15.3 with system gcc 7.5.0, I run into: ... In file included from ../bfd/bfd.h:46:0, from gdb/defs.h:37, from gdb/debuginfod-support.c:19: gdb/debuginfod-support.c: In function ‘bool debuginfod_is_enabled()’: gdb/../include/diagnostics.h:42:3: error: unknown option after \ ‘#pragma GCC diagnostic’ kind [-Werror=pragmas] _Pragma (DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored option)) ^ gdb/../include/diagnostics.h:80:3: note: in expansion of macro \ ‘DIAGNOSTIC_IGNORE’ DIAGNOSTIC_IGNORE ("-Wstringop-overread") ^~~~~~~~~~~~~~~~~ gdb/debuginfod-support.c:201:4: note: in expansion of macro \ ‘DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD’ DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD ^ ... The problem is that the warning -Wstringop-overread has been introduced for gcc 11, and we can only tell gcc to ignore if it knows about it. Fix this by guarding the DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD definition in diagnostics.c with '#if __GNUC__ >= 11'. Tested on x86_64-linux, by completing a build.
Diffstat (limited to 'include')
-rw-r--r--include/diagnostics.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/diagnostics.h b/include/diagnostics.h
index 8bf5a3c3d9..3da8828226 100644
--- a/include/diagnostics.h
+++ b/include/diagnostics.h
@@ -76,8 +76,10 @@
# define DIAGNOSTIC_IGNORE_STRINGOP_TRUNCATION \
DIAGNOSTIC_IGNORE ("-Wstringop-truncation")
+# if __GNUC__ >= 11
# define DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD \
DIAGNOSTIC_IGNORE ("-Wstringop-overread")
+#endif
# define DIAGNOSTIC_IGNORE_FORMAT_NONLITERAL \
DIAGNOSTIC_IGNORE ("-Wformat-nonliteral")