diff options
| author | Yann Gautier <yann.gautier@st.com> | 2026-08-28 14:33:03 +0200 |
|---|---|---|
| committer | Yann Gautier <yann.gautier@st.com> | 2026-09-07 13:41:30 +0200 |
| commit | ccb3eb9aefd8b2f6d762366c4c7ba0a2e81b720e (patch) | |
| tree | fb46ee3e5c98b31cdef81cc1d2df80bf088da607 | |
| parent | dd82fce0866b0a0ebc5129b5f23ff39a7e2121a9 (diff) | |
| download | arm-trusted-firmware-ccb3eb9aefd8b2f6d762366c4c7ba0a2e81b720e.tar.gz arm-trusted-firmware-ccb3eb9aefd8b2f6d762366c4c7ba0a2e81b720e.zip | |
feat(build): enable -Wundef for C files if W >= 1
Add -Wundef to BL_FLAGS. This will then be enabled for all TF-A C files
through MAKE_C macro, but not for libs.
This flag is enabled only when W is defined in the build command line
and greater or equal to 1.
Change-Id: I6c327584b1e1bb0e1eb59c774a6c6a6788139b99
Signed-off-by: Yann Gautier <yann.gautier@st.com>
| -rw-r--r-- | make_helpers/cflags.mk | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/make_helpers/cflags.mk b/make_helpers/cflags.mk index 3aacd4659..d00c8e17d 100644 --- a/make_helpers/cflags.mk +++ b/make_helpers/cflags.mk @@ -52,8 +52,6 @@ WARNING2 := $(WARNING1) WARNING2 += -Wold-style-definition WARNING2 += -Wmissing-prototypes WARNING2 += -Wmissing-format-attribute -# TF-A aims to comply with this eventually. Effort too large at present -WARNING2 += -Wundef # currently very involved and many platforms set this off WARNING2 += -Wunused-const-variable=2 @@ -69,6 +67,15 @@ WARNING3 += -Wpacked WARNING3 += -Wpointer-arith WARNING3 += -Wswitch-default +# The -Wundef cannot be easily handled through warning flags. +# This would bring warning for libs (compiler-rt, zlib). +# Instead add it to BL_FLAGS that is only used by MAKE_C macro. +# TODO: remove the W=1 check for -Wundef when all the related warnings +# are corrected. +ifeq ($(shell test $(W) -ge 1 && echo true),true) +BL_FLAGS += -Wundef +endif + cflags-common += $(WARNING$(W)) ifneq (${E},0) cflags-common += -Werror |
