Avoid spurious warnings from GCC.

As mentioned recently on the developers list, GCC versions 9 10 and 11 are
emitting suprious warnings with -Warray-bounds for the specialised code they
introduce for strcmp etc. Disable that warning for those versions of GCC. In
addition to this issue, according to the GCC bug database is is generating a
lot of false positives anyway.

configure.ac:
scripts/mgnuc.in:
    As above.
This commit is contained in:
Julien Fischer
2022-03-05 22:39:10 +11:00
parent 341e20545c
commit d78fcae24d
2 changed files with 19 additions and 0 deletions

View File

@@ -4368,6 +4368,14 @@ case "$mercury_cv_cc_type" in
# and why, see scripts/mgnuc.in.
CFLAGS_FOR_WARNINGS="-Wall -Wwrite-strings -Wshadow -Wmissing-prototypes -Wno-unused -Wno-uninitialized -Wstrict-prototypes"
# See scripts/mgnuc.in for an explanation of why we set
# -Wno-array-bounds here.
case "$C_COMPILER_TYPE" in
gcc_9_*|gcc_10_*|gcc_11_*)
CFLAGS_FOR_WARNINGS="$CFLAGS_FOR_WARNINGS -Wno-array-bounds"
;;
esac
# Enabling -fomit-frame-pointer causes setjmp/longjmp to misbehave
# with MinGW on Windows XP.
case "$host" in

View File

@@ -570,6 +570,17 @@ case "${FULLARCH}" in
;;
esac
# gcc versions 9, 10 and 11 replace calls to strcmp and related functions with
# specialised code when some of the arguments are string constants.
# The above versions of gcc emit spurious warnings about the code they
# introduce when -Warray-bounds is enabled.
#
case "${C_COMPILER_TYPE}" in
gcc_9_*|gcc_10_*|gcc_11_*)
CHECK_OPTS="${CHECK_OPTS} -Wno-array-bounds"
;;
esac
case ${COMPILER} in gcc)
case "${FULLARCH}" in
i*86*)