summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2016-02-09 16:10:22 +0100
committerMark Wielaard <mjw@redhat.com>2016-02-15 23:45:35 +0100
commit8bc1423bdc6f0790a669a43ce1604763a3e55587 (patch)
treead4440547746fac6fe138cc8f411ebde11bce053 /config
parentf4dc76404ce8116b806550d7515ec98be953df9e (diff)
downloadelfutils-8bc1423bdc6f0790a669a43ce1604763a3e55587.tar.gz
config: Check for and use gcc -Wlogical-op and -Wduplicated-cond.
Both -Wlogical-op and -Wduplicated-cond may produce useful warnings. But we have to check them first. Older versions of gcc had a -Wlogical-op that warned on some constructs using macros that are not erronious. Only GCC6 has -Wduplicated-cond. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'config')
-rw-r--r--config/ChangeLog6
-rw-r--r--config/eu.am16
2 files changed, 21 insertions, 1 deletions
diff --git a/config/ChangeLog b/config/ChangeLog
index 8e20f1e6..8523cb31 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-09 Mark Wielaard <mjw@redhat.com>
+
+ * eu.am: Check SANE_LOGICAL_OP_WARNING and
+ HAVE_DUPLICATED_COND_WARNING.
+ (AM_CFLAGS): Add LOGICAL_OP_WARNING and DUPLICATED_COND_WARNING.
+
2016-01-08 Mark Wielaard <mjw@redhat.com>
* elfutils.spec.in: Add elfcompress. Update for 0.165.
diff --git a/config/eu.am b/config/eu.am
index 0095da5a..c4e9279a 100644
--- a/config/eu.am
+++ b/config/eu.am
@@ -1,6 +1,6 @@
## Common automake fragments for elfutils subdirectory makefiles.
##
-## Copyright (C) 2010, 2014 Red Hat, Inc.
+## Copyright (C) 2010, 2014, 2016 Red Hat, Inc.
##
## This file is part of elfutils.
##
@@ -42,8 +42,22 @@ STACK_USAGE_WARNING=-Wstack-usage=262144
else
STACK_USAGE_WARNING=
endif
+
+if SANE_LOGICAL_OP_WARNING
+LOGICAL_OP_WARNING=-Wlogical-op
+else
+LOGICAL_OP_WARNING=
+endif
+
+if HAVE_DUPLICATED_COND_WARNING
+DUPLICATED_COND_WARNING=-Wduplicated-cond
+else
+DUPLICATED_COND_WARNING=
+endif
+
AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
-Wold-style-definition -Wstrict-prototypes \
+ $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \
$(if $($(*F)_no_Werror),,-Werror) \
$(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
$(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \