xcompile: Use Walloc-size GCC option

Warn about allocation function calls with insufficient size for the
target type of the pointer.
commit 6ab188ee6c ("Makefile.mk: Use Walloc-size GCC option")
introduced this GCC option, then commit d05fe9fd3c ("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 <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84074
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Elyes Haouas 2024-08-24 08:33:22 +02:00 committed by Felix Singer
commit aebef78622

View file

@ -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"