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 <fengwei.yin@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yin Fengwei 2020-06-10 17:10:58 +08:00 committed by wenlingz
parent 215829fd7e
commit ef5c1b5481
1 changed files with 3 additions and 0 deletions

View File

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