From ef5c1b5481acf7f9d2bd344bbc0de7753cef989a Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Wed, 10 Jun 2020 17:10:58 +0800 Subject: [PATCH] Build: disable zero length array warning We hit following build error when using gcc10: arch/x86/page.c:240:48: error: array subscript is outside array bounds of 'struct page[0][1]' [-Werror=array-bounds] It happens with gcc10 on different Linux distributions. Regarding the case that ACRN depends on zero length array in sevaral places, we disable the zero length array warning by gcc option. Tracked-On: #4810 Signed-off-by: Yin Fengwei Reviewed-by: Jason Chen CJ Reviewed-by: Eddie Dong --- hypervisor/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hypervisor/Makefile b/hypervisor/Makefile index 8109b7986..9298579fc 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -78,6 +78,9 @@ CFLAGS += -m64 -mno-mmx -mno-sse -mno-sse2 -mno-80387 -mno-fp-ret-in-387 CFLAGS += -mno-red-zone -mpopcnt CFLAGS += -nostdinc -nostdlib -fno-common CFLAGS += -Werror + +# ACRN depends on zero length array. Silence the gcc if Warrary-bounds is default option +CFLAGS += -Wno-array-bounds CFLAGS += -O2 ifeq (y, $(CONFIG_RELOC)) CFLAGS += -fpie