Makefile: Add default warning flags

The flags are taken from the different warning levels of the build
system when they do not generate any error with the current upstreamed
platforms.

Change-Id: Ia70cff83bedefb6d2f0dd266394ef77fe47e7f65
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>
This commit is contained in:
Ambroise Vincent 2019-05-24 12:47:43 +01:00
parent ced1711297
commit 00296576c5
1 changed files with 10 additions and 6 deletions

View File

@ -193,23 +193,19 @@ ASFLAGS_aarch32 = $(march32-directive)
ASFLAGS_aarch64 = $(march64-directive)
WARNING1 := -Wextra
WARNING1 += -Wunused -Wno-unused-parameter
WARNING1 += -Wmissing-declarations
WARNING1 += -Wmissing-format-attribute
WARNING1 += -Wmissing-prototypes
WARNING1 += -Wold-style-definition
WARNING1 += -Wunused-but-set-variable
WARNING1 += -Wunused-const-variable
WARNING2 := -Waggregate-return
WARNING2 += -Wcast-align
WARNING2 += -Wdisabled-optimization
WARNING2 += -Wnested-externs
WARNING2 += -Wshadow
WARNING2 += -Wlogical-op
WARNING2 += -Wmissing-field-initializers
WARNING2 += -Wsign-compare
WARNING2 += -Wmaybe-uninitialized
WARNING3 := -Wbad-function-cast
WARNING3 += -Wcast-qual
@ -219,8 +215,6 @@ WARNING3 += -Wpadded
WARNING3 += -Wpointer-arith
WARNING3 += -Wredundant-decls
WARNING3 += -Wswitch-default
WARNING3 += -Wpacked-bitfield-compat
WARNING3 += -Wvla
ifeq (${W},1)
WARNINGS := $(WARNING1)
@ -230,6 +224,16 @@ else ifeq (${W},3)
WARNINGS := $(WARNING1) $(WARNING2) $(WARNING3)
endif
WARNINGS += -Wunused -Wno-unused-parameter \
-Wdisabled-optimization \
-Wvla
ifeq ($(findstring clang,$(notdir $(CC))),)
WARNINGS += -Wunused-but-set-variable \
-Wmaybe-uninitialized \
-Wpacked-bitfield-compat
endif
ifneq (${E},0)
ERRORS := -Werror
endif