aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-07-27 15:49:52 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-09 10:29:18 -0300
commit5b96d7fe7f569273a88db5f78e01d41ce088a7f5 (patch)
tree3c3114392bca44c67c84be84ff41b46829928be3
parent82918c893a2228b5b12aa7db18470b0238b9f14f (diff)
downloadglibc-5b96d7fe7f569273a88db5f78e01d41ce088a7f5.tar
glibc-5b96d7fe7f569273a88db5f78e01d41ce088a7f5.tar.gz
glibc-5b96d7fe7f569273a88db5f78e01d41ce088a7f5.tar.bz2
glibc-5b96d7fe7f569273a88db5f78e01d41ce088a7f5.zip
configure: Use -Wno-restrict iff compiler supports it
-rwxr-xr-xconfigure24
-rw-r--r--configure.ac8
-rw-r--r--libio/Makefile4
3 files changed, 34 insertions, 2 deletions
diff --git a/configure b/configure
index 9c577b2bbf..7dc395193a 100755
--- a/configure
+++ b/configure
@@ -7215,6 +7215,30 @@ printf "%s\n" "$libc_cv_wno_maybe_uninitialized" >&6; }
config_vars="$config_vars
config-cflags-wno-maybe-uninitialized = $libc_cv_wno_maybe_uninitialized"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -Wno-restrict" >&5
+printf %s "checking for -Wno-restrict... " >&6; }
+if test ${libc_cv_wno_restrict+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if { ac_try='${CC-cc} -Werror -Wno-restrict -xc /dev/null -S -o /dev/null'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+then :
+ libc_cv_wno_restrict=-Wno-restrict
+else $as_nop
+ libc_cv_wno_restrict=
+fi
+
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_wno_restrict" >&5
+printf "%s\n" "$libc_cv_wno_restrict" >&6; }
+config_vars="$config_vars
+config-cflags-wno-restrict = $libc_cv_wno_restrict"
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -fexcess-precision=standard" >&5
printf %s "checking for -fexcess-precision=standard... " >&6; }
if test ${libc_cv_fexcess_precision_standard+y}
diff --git a/configure.ac b/configure.ac
index f0ef446df3..fc50642673 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1394,6 +1394,14 @@ AC_CACHE_CHECK([for -Wno-maybe-uninitialized], libc_cv_wno_maybe_uninitialized,
LIBC_CONFIG_VAR([config-cflags-wno-maybe-uninitialized],
[$libc_cv_wno_maybe_uninitialized])
+AC_CACHE_CHECK([for -Wno-restrict], libc_cv_wno_restrict, [dnl
+ LIBC_TRY_CC_OPTION([-Werror -Wno-restrict],
+ [libc_cv_wno_restrict=-Wno-restrict],
+ [libc_cv_wno_restrict=])
+])
+LIBC_CONFIG_VAR([config-cflags-wno-restrict],
+ [$libc_cv_wno_restrict])
+
AC_CACHE_CHECK([for -fexcess-precision=standard], libc_cv_fexcess_precision_standard, [dnl
LIBC_TRY_CC_OPTION([-Werror -fexcess-precision=standard],
[libc_cv_fexcess_precision_standard=-fexcess-precision=standard],
diff --git a/libio/Makefile b/libio/Makefile
index 27623c92a9..385bee9b7d 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -187,8 +187,8 @@ CFLAGS-tst-bz24153.c += $(no-fortify-source)
CFLAGS-tst_putwc.c += -DOBJPFX=\"$(objpfx)\"
# These test cases intentionally use overlapping arguments
-CFLAGS-tst-sprintf-ub.c += -Wno-restrict $(no-fortify-source)
-CFLAGS-tst-sprintf-chk-ub.c += -Wno-restrict $(no-fortify-source)
+CFLAGS-tst-sprintf-ub.c += $(config-cflags-wno-restrict) $(no-fortify-source)
+CFLAGS-tst-sprintf-chk-ub.c += $(config-cflags-wno-restrict) $(no-fortify-source)
LDFLAGS-tst-bz24228 = -Wl,--version-script=tst-bz24228.map