summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2016-11-02 13:29:26 +0100
committerMark Wielaard <mjw@redhat.com>2016-11-10 11:59:00 +0100
commita3cc8182b2ae05290b0eafa74b70746d7befc0e4 (patch)
tree7d1f74f9f464b810a95dc7cd78c73930a938924a /config
parent33ca0e1b9dfb47c6f9836c7fc19d04bd34337767 (diff)
Add GCC7 -Wimplicit-fallthrough support/fixes.
GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one small buglet in elflint option procession. So it seems useful to enable to make sure all swatch case fallthroughs are deliberate. Add configure check to detect whether gcc support -Wimplicit-fallthrough and enable it. Add fixes and explicit fallthrough comments where necessary. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'config')
-rw-r--r--config/ChangeLog5
-rw-r--r--config/eu.am8
2 files changed, 12 insertions, 1 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index 2ca25bc3..a18fa847 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-02 Mark Wielaard <mjw@redhat.com>
+
+ * eu.am: Check HAVE_IMPLICIT_FALLTHROUGH_WARNING.
+ (AM_CFLAGS): Add IMPLICIT_FALLTHROUGH_WARNING.
+
2016-08-04 Mark Wielaard <mjw@redhat.com>
* elfutils.spec.in: Update for 0.167.
diff --git a/config/eu.am b/config/eu.am
index 4998771d..8fe1e259 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -61,10 +61,16 @@ else
NULL_DEREFERENCE_WARNING=
endif
+if HAVE_IMPLICIT_FALLTHROUGH_WARNING
+IMPLICIT_FALLTHROUGH_WARNING=-Wimplicit-fallthrough
+else
+IMPLICIT_FALLTHROUGH_WARNING=
+endif
+
AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
-Wold-style-definition -Wstrict-prototypes \
$(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
- $(NULL_DEREFERENCE_WARNING) \
+ $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \
$(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \