diff options
author | Paul Menzel <pmenzel@molgen.mpg.de> | 2022-07-23 10:25:34 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-08-02 21:16:52 +0000 |
commit | 65377eba7fa0c7d46e5e88a92f667ae40ea08ef2 (patch) | |
tree | f1710f620094779f870ce5552d9a19db40e19fc5 /Makefile.inc | |
parent | be5dc3daa00414ae04b1801f59142245e0e4d17f (diff) |
Makefile.inc: Disable compiler warning array-compare for GCC
gcc 12 fails the build with the warning below:
CC romstage/lib/cbfs.o
src/lib/cbfs.c: In function 'switch_to_postram_cache':
src/lib/cbfs.c:31:32: error: comparison between two arrays [-Werror=array-compare]
31 | if (_preram_cbfs_cache != _postram_cbfs_cache)
| ^~
src/lib/cbfs.c:31:32: note: use '&_preram_cbfs_cache[0] != &_postram_cbfs_cache[0]' to compare the addresses
Instead of following gcc’s suggestion, disable the warning for gcc as
requested by Julius [1]:
> Can we just set -Wno-array-compare instead? There's nothing illegal
> about that expression and as we can see in this case, there are
> perfectly reasonable cases where you might want to do something like
> that. On the other hand, I don't really see a realistic scenario where
> this warning could prevent a real problem (anyone who doesn't know
> that array1 == array2 doesn't compare the array elements in C
> shouldn't have any business submitting code to coreboot).
[1]: https://review.coreboot.org/c/coreboot/+/62827/1
Found-by: gcc-12 (Debian 12-20220313-1) 12.0.1 20220314 (experimental) [master r12-7638-g823b3b79cd2]
Found-by: gcc (Debian 12.1.0-7) 12.1.0
Change-Id: I322f7cc57dcca713141bddaaaed9ec034898754d
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/66105
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'Makefile.inc')
-rw-r--r-- | Makefile.inc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Makefile.inc b/Makefile.inc index 8d3e8fcf22..d2235e0c07 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -442,7 +442,7 @@ ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),) CFLAGS_common += -Wno-packed-not-aligned CFLAGS_common += -fconserve-stack CFLAGS_common += -Wnull-dereference -Wreturn-type -CFLAGS_common += -Wlogical-op -Wduplicated-cond +CFLAGS_common += -Wlogical-op -Wduplicated-cond -Wno-array-compare # cf. commit f69a99db (coreboot: x86: enable gc-sections) CFLAGS_common += -Wno-unused-but-set-variable endif |