[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] Don’t assume compilers don’t output to stderr
From: |
Paul Eggert |
Subject: |
[PATCH 4/7] Don’t assume compilers don’t output to stderr |
Date: |
Thu, 26 Jan 2023 14:17:35 -0800 |
Redo the computation of ac_cv_have_no_reorder and
ac_cv_have_returns_nonnull so that we don’t assume
their complicated compilations do not output to stdout.
Problem found on gcc401, which has CLFS for LoongArch64 7.2
with GCC 13.0.0 20221018 (experimental).
---
configure.ac | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e314f1..b4db5b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1194,16 +1194,15 @@ fi
# Check for specific attributes not supported by older versions of GCC;
# and possibly by other compilers. Notice that we have to temporarily
-# change CFLAGS (in a subshell, so as not to affect the rest of this
-# script) to force -Werror. If -Werror is not supported than the tests
+# change CFLAGS to force -Werror. If -Werror is not supported than the tests
# will all fail, which is the correct conservative behavior.
-# Out of the subshell, define the shell variable ac_cv_have_ATTRIBUTE ,
-# in order for the test result to be visible in the following.
# FIXME: I should factor the following with M4.
+jitter_save_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -Werror"
+
# Check for attribute no_reorder .
-ac_cv_have_no_reorder=$(CFLAGS="$CFLAGS -Werror"; export CFLAGS
AC_CACHE_CHECK([for the no_reorder attribute],
[ac_cv_have_no_reorder],
[AC_COMPILE_IFELSE(
@@ -1221,11 +1220,9 @@ AC_CACHE_CHECK([for the no_reorder attribute],
if test "x$ac_cv_have_no_reorder" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ATTRIBUTE_NO_REORDER], [1],
[Define if the no_reorder attribute works])
-fi;
-echo "$ac_cv_have_no_reorder")
+fi
# Check for attribute returns_nonnull .
-ac_cv_have_returns_nonnull=$(CFLAGS="$CFLAGS -Werror"; export CFLAGS
AC_CACHE_CHECK([for the returns_nonnull attribute],
[ac_cv_have_returns_nonnull],
[AC_COMPILE_IFELSE(
@@ -1244,7 +1241,9 @@ if test "x$ac_cv_have_returns_nonnull" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ATTRIBUTE_RETURNS_NONNULL], [1],
[Define if the returns_nonnull attribute works])
fi
-echo "$ac_cv_have_returns_nonnull")
+
+# End of -Werror section.
+CFLAGS=$jitter_save_CFLAGS
# Many people like to compile with -Werror. This is a way of redefining
# attributes not supported by the compiler so that they expand to nothing.
--
2.39.1
- [PATCH 0/7] improve porting and Gnulib integration, Paul Eggert, 2023/01/26
- [PATCH 2/7] Update bootstrap from Gnulib, Paul Eggert, 2023/01/26
- [PATCH 5/7] Omit some redundant include directives, Paul Eggert, 2023/01/26
- [PATCH 3/7] Update LDADD for recent Gnulib, Paul Eggert, 2023/01/26
- [PATCH 7/7] Remove unused attribute macro, Paul Eggert, 2023/01/26
- [PATCH 1/7] Port bootstrap.conf BREs to POSIX, Paul Eggert, 2023/01/26
- [PATCH 6/7] Simplify __attribute__ tests, less porting hassle, Paul Eggert, 2023/01/26
- [PATCH 4/7] Don’t assume compilers don’t output to stderr,
Paul Eggert <=