summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJustin Chadwell <justin.chadwell@arm.com>2019-07-03 14:15:56 +0100
committerJustin Chadwell <justin.chadwell@arm.com>2019-07-12 09:12:19 +0100
commit93c690eba8ca67b06925d811ea87765215401385 (patch)
tree684c369e68366beb1542880e44f6ed96e1fe08c7 /Makefile
parent3e43121ed16996758342aafdc42806ea2a0fe181 (diff)
Enable -Wshift-overflow=2 to check for undefined shift behavior
The -Wshift-overflow=2 option enables checks for left bit shifts. Specifically, the option will warn when the result of a shift will be placed into a signed integer and overflow the sign bit there, which results in undefined behavior. To avoid the warnings from these checks, the left operand of a shift can be made an unsigned integer by using the U() macro or appending the u suffix. Change-Id: I50c67bedab86a9fdb6c87cfdc3e784f01a22d560 Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 471cf598..c4730929 100644
--- a/Makefile
+++ b/Makefile
@@ -256,9 +256,14 @@ WARNINGS += -Wunused -Wno-unused-parameter \
-Wvla
ifeq ($(findstring clang,$(notdir $(CC))),)
+# not using clang
WARNINGS += -Wunused-but-set-variable \
-Wmaybe-uninitialized \
- -Wpacked-bitfield-compat
+ -Wpacked-bitfield-compat \
+ -Wshift-overflow=2
+else
+# using clang
+WARNINGS += -Wshift-overflow -Wshift-sign-overflow
endif
ifneq (${E},0)