* [RFA] Fix the clang build
@ 2018-05-10 15:05 Tom Tromey
2018-05-10 16:47 ` Simon Marchi
0 siblings, 1 reply; 2+ messages in thread
From: Tom Tromey @ 2018-05-10 15:05 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
Simon pointed out that gdb would not build with clang, due to the
addition of -Wimplicit-fallthrough. This patch fixes the problem by
using -Wimplicit-fallthrough=3 -- this does not work with clang,
bypassing the issue.
Tested by rebuilding with both gcc and clang; and also by verifying
that -Wimplicit-fallthrough=3 is used in the gcc build.
I will file a follow-up bug to convert the fall-through comments to a
form that can be used by both clang and gcc.
gdb/ChangeLog
2018-05-10 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* warning.m4 (AM_GDB_WARNINGS): Use -Wimplicit-fallthrough=3.
gdb/gdbserver/ChangeLog
2018-05-10 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
---
gdb/ChangeLog | 5 +++++
gdb/configure | 2 +-
gdb/gdbserver/ChangeLog | 4 ++++
gdb/gdbserver/configure | 2 +-
gdb/warning.m4 | 2 +-
5 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/gdb/configure b/gdb/configure
index 0eec780bd1..4186f7e160 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -15367,7 +15367,7 @@ build_warnings="-Wall -Wpointer-arith \
-Wno-mismatched-tags \
-Wno-error=deprecated-register \
-Wsuggest-override \
--Wimplicit-fallthrough \
+-Wimplicit-fallthrough=3 \
-Wduplicated-cond"
case "${host}" in
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index ac61ba3543..b2e2e8f955 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -7174,7 +7174,7 @@ build_warnings="-Wall -Wpointer-arith \
-Wno-mismatched-tags \
-Wno-error=deprecated-register \
-Wsuggest-override \
--Wimplicit-fallthrough \
+-Wimplicit-fallthrough=3 \
-Wduplicated-cond"
case "${host}" in
diff --git a/gdb/warning.m4 b/gdb/warning.m4
index cb23472ec6..632cc214ac 100644
--- a/gdb/warning.m4
+++ b/gdb/warning.m4
@@ -44,7 +44,7 @@ build_warnings="-Wall -Wpointer-arith \
-Wno-mismatched-tags \
-Wno-error=deprecated-register \
-Wsuggest-override \
--Wimplicit-fallthrough \
+-Wimplicit-fallthrough=3 \
-Wduplicated-cond"
case "${host}" in
--
2.13.6
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFA] Fix the clang build
2018-05-10 15:05 [RFA] Fix the clang build Tom Tromey
@ 2018-05-10 16:47 ` Simon Marchi
0 siblings, 0 replies; 2+ messages in thread
From: Simon Marchi @ 2018-05-10 16:47 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 2018-05-10 10:40, Tom Tromey wrote:
> Simon pointed out that gdb would not build with clang, due to the
> addition of -Wimplicit-fallthrough. This patch fixes the problem by
> using -Wimplicit-fallthrough=3 -- this does not work with clang,
> bypassing the issue.
>
> Tested by rebuilding with both gcc and clang; and also by verifying
> that -Wimplicit-fallthrough=3 is used in the gcc build.
>
> I will file a follow-up bug to convert the fall-through comments to a
> form that can be used by both clang and gcc.
Thanks, that patch is fine with me.
To be clear for those who might not be aware of the mechanism: the
configure script tests each warning flag to see if it's supported by the
current compiler. Since -Wimplicit-fallthrough=3 is not supported by
clang, it won't be included. This means that we won't get the
fallthrough warnings when building with clang. I think it's fine, since
we get them through gcc, so an unintended fallthrough would be found
pretty quickly anyway.
Simon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-10 15:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-10 15:05 [RFA] Fix the clang build Tom Tromey
2018-05-10 16:47 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox