aboutsummaryrefslogtreecommitdiff
path: root/sim/configure
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-29 20:16:38 -0400
committerMike Frysinger <vapier@gentoo.org>2024-01-08 21:36:44 -0500
commit435ad222b3de93fa647fba7221eece36b1b395eb (patch)
tree596d8d68a79a4625ebb58cdde00a3080b72d8594 /sim/configure
parent5048cb28f4a864d2426bcec8cb02f26ef3daac85 (diff)
downloadgdb-435ad222b3de93fa647fba7221eece36b1b395eb.zip
gdb-435ad222b3de93fa647fba7221eece36b1b395eb.tar.gz
gdb-435ad222b3de93fa647fba7221eece36b1b395eb.tar.bz2
sim: warnings: compile build tools with -Werror too
Add support for compiling build tools with various -Werror settings. Since the tools don't compile cleanly with the same set of flags as the rest of the sim code, we need to maintain & test a separate list. Only bother when not cross-compiling so we don't have to test all the flags against the build compiler. This should be good enough for our actual development flows.
Diffstat (limited to 'sim/configure')
-rwxr-xr-xsim/configure70
1 files changed, 67 insertions, 3 deletions
diff --git a/sim/configure b/sim/configure
index 88dc76f..e8d7be5 100755
--- a/sim/configure
+++ b/sim/configure
@@ -991,6 +991,8 @@ PACKAGE_NAME
PATH_SEPARATOR
SHELL
SIM_TOOLCHAIN_VARS
+BUILD_WERROR_CFLAGS
+BUILD_WARN_CFLAGS
WERROR_CFLAGS
WARN_CFLAGS'
ac_subst_files=''
@@ -12683,7 +12685,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12686 "configure"
+#line 12688 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12789,7 +12791,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 12792 "configure"
+#line 12794 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16179,6 +16181,12 @@ build_warnings="$build_warnings
-Wstrict-prototypes
-Wno-enum-conversion
"
+build_build_warnings="
+-Wno-missing-braces
+-Wno-stringop-truncation
+-Wno-implicit-fallthrough
+-Wno-shadow=local
+"
case "${host}" in
*-*-mingw32*)
@@ -16228,9 +16236,12 @@ if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
fi
fi
WARN_CFLAGS=""
+BUILD_WARN_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5
$as_echo_n "checking compiler warning flags... " >&6; }
# Separate out the -Werror flag as some files just cannot be
# compiled with it enabled.
@@ -16273,6 +16284,59 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
$as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
+
+ if test "x$cross_compiling" = "xno"; then :
+ SAVE_WARN_CFLAGS=$WARN_CFLAGS
+ build_warnings=$build_build_warnings
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler warning flags" >&5
+$as_echo_n "checking compiler warning flags... " >&6; }
+ # Separate out the -Werror flag as some files just cannot be
+ # compiled with it enabled.
+ for w in ${build_warnings}; do
+ case $w in
+ -Werr*) WERROR_CFLAGS=-Werror ;;
+ *) w="$w"
+ case $w in
+ -Wno-*)
+ wtest=`echo $w | sed 's/-Wno-/-W/g'` ;;
+ -Wformat-nonliteral)
+ w="-Wformat $w"
+ wtest="$w"
+ ;;
+ *)
+ wtest=$w ;;
+ esac
+
+ saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -Werror $wtest"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ WARN_CFLAGS="${WARN_CFLAGS} $w"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS="$saved_CFLAGS"
+ ;;
+ esac
+ done
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${WARN_CFLAGS} ${WERROR_CFLAGS}" >&5
+$as_echo "${WARN_CFLAGS} ${WERROR_CFLAGS}" >&6; }
+
+ BUILD_WARN_CFLAGS=$WARN_CFLAGS
+ WARN_CFLAGS=$SAVE_WARN_CFLAGS
+ BUILD_WERROR_CFLAGS=$WERROR_CFLAGS
+
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-shadow=local is supported" >&5
$as_echo_n "checking whether -Wno-shadow=local is supported... " >&6; }
w="-Wno-shadow=local"