mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-20 19:44:23 +00:00
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>
This commit is contained in:
parent
3e43121ed1
commit
93c690eba8
1 changed files with 6 additions and 1 deletions
7
Makefile
7
Makefile
|
@ -256,9 +256,14 @@ WARNINGS += -Wunused -Wno-unused-parameter \
|
||||||
-Wvla
|
-Wvla
|
||||||
|
|
||||||
ifeq ($(findstring clang,$(notdir $(CC))),)
|
ifeq ($(findstring clang,$(notdir $(CC))),)
|
||||||
|
# not using clang
|
||||||
WARNINGS += -Wunused-but-set-variable \
|
WARNINGS += -Wunused-but-set-variable \
|
||||||
-Wmaybe-uninitialized \
|
-Wmaybe-uninitialized \
|
||||||
-Wpacked-bitfield-compat
|
-Wpacked-bitfield-compat \
|
||||||
|
-Wshift-overflow=2
|
||||||
|
else
|
||||||
|
# using clang
|
||||||
|
WARNINGS += -Wshift-overflow -Wshift-sign-overflow
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (${E},0)
|
ifneq (${E},0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue