[PATCH 3/4] kbuild: add -Wtype-limits to compile flags
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Mar 24 12:22:46 GMT 2021
Not warning about e.g. comparisons of unsigned integers with 0 can
introduce nasty bugs around error handling especially.
Enable the warning to be able to identify these issues in future.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
Makefile | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Makefile b/Makefile
index 6d78d1f58eca..81ceedafeb0c 100644
--- a/Makefile
+++ b/Makefile
@@ -650,6 +650,9 @@ CHECKFLAGS += $(NOSTDINC_FLAGS)
# warn about C99 declaration after statement
KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
+# warn about e.g. (unsigned)x < 0
+KBUILD_CFLAGS += $(call cc-option,-Wtype-limits)
+
# disable pointer signed / unsigned warnings in gcc 4.0
KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
--
2.29.2
More information about the barebox
mailing list