From aebef786221b1470a5a02e23964fa748b2f90f25 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Sat, 24 Aug 2024 08:33:22 +0200 Subject: [PATCH] xcompile: Use Walloc-size GCC option Warn about allocation function calls with insufficient size for the target type of the pointer. commit 6ab188ee6c99 ("Makefile.mk: Use Walloc-size GCC option") introduced this GCC option, then commit d05fe9fd3ce9 ("Revert "Makefile.mk:Use Localiser GCC option"") reverted it because older GCC versions did not support it. This change re-enables it for GCC version equal or greater than 14.1.0. Change-Id: If5d36b073bb5b4cccb0cf2b67b43edb3f97f168c Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/84074 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Felix Singer --- util/xcompile/xcompile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index 3fb0cb7591..6443dd2a90 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -208,6 +208,9 @@ detect_special_flags() { testcc "$GCC" "$CFLAGS_GCC -Wcalloc-transposed-args" && CFLAGS_GCC="$CFLAGS_GCC -Wcalloc-transposed-args" + testcc "$GCC" "$CFLAGS_GCC -Walloc-size" && + CFLAGS_GCC="$CFLAGS_GCC -Walloc-size" + testcc "$GCC" "$CFLAGS_GCC -Wno-unused-parameter" && CFLAGS_GCC="$CFLAGS_GCC -Wno-unused-parameter"