Skip to content

Commit 9aab60b

Browse files
kwvgknst
andcommitted
build: don't error on -Warray-bounds and -Wdangling-reference with GCC
Currently, `-Warray-bounds` is triggered by `immer` code and `-Wdangling-reference` is triggered by UniValue-adjacent code. Co-authored-by: Konstantin Akimov <[email protected]>
1 parent 18fcb26 commit 9aab60b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

configure.ac

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,22 @@ if test "$enable_werror" = "yes"; then
452452
fi
453453
ERROR_CXXFLAGS=$CXXFLAG_WERROR
454454

455+
dnl -Warray-bounds and -Wdangling-reference cause problems with GCC. Do not treat these warnings as errors.
456+
dnl Suppress -Warray-bounds entirely because of noisy output, currently unhappy with immer implementation.
457+
AX_CHECK_COMPILE_FLAG([-Warray-bounds], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-array-bounds"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([
458+
#if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__)
459+
#error Non-GCC compiler detected, not setting flag
460+
#endif
461+
int main(void) { return 0; }
462+
])])
463+
dnl TODO: Remove suppression after backporting bitcoin#27605
464+
AX_CHECK_COMPILE_FLAG([-Wdangling-reference], [NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-error=dangling-reference"], [], [$CXXFLAG_WERROR], [AC_LANG_SOURCE([
465+
#if defined(__clang__) || defined(__INTEL_COMPILER) || !defined(__GNUC__)
466+
#error Non-GCC compiler detected, not setting flag
467+
#endif
468+
int main(void) { return 0; }
469+
])])
470+
455471
dnl -Wstringop-overread and -Wstringop-overflow are broken in gcc
456472
AX_CHECK_COMPILE_FLAG([-Wstringop-overread], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wno-stringop-overread"], [], [$CXXFLAG_WERROR])
457473
AX_CHECK_COMPILE_FLAG([-Wstringop-overflow], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wno-stringop-overflow"], [], [$CXXFLAG_WERROR])

0 commit comments

Comments
 (0)