From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 3BCC03858022; Wed, 30 Aug 2023 12:42:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BCC03858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1693399379; bh=0DDjwxWcwjCWGCcrmPs9hjp5J/6+94Q0ZvVoPXgJ0Ws=; h=From:To:Subject:Date:From; b=YaRF9GZiO7W37OJ84LqC2cXn1XmBbIPcJnYAYcQ/SWRsuztvcXHbmhSP4G+U7LrCs /iDrUyBimhBG4Xfyl+iKxxcJNU1w2n41ZK2Qu2HUw/0j54+JVBn/alIlqd/H41hSf1 a3eW/iYoty7Yd3m/Zl4dcpNJhPUVY/xI6orF89GQ= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] configure: Use -Wno-restrict iff compiler supports it X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 61b957443637b2de60077467fe3e31dc39ad696a X-Git-Newrev: c9d7a5f98e0f83eca593a554d619598080aeedf9 Message-Id: <20230830124259.3BCC03858022@sourceware.org> Date: Wed, 30 Aug 2023 12:42:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c9d7a5f98e0f83eca593a554d619598080aeedf9 commit c9d7a5f98e0f83eca593a554d619598080aeedf9 Author: Adhemerval Zanella Date: Thu Jul 27 15:49:52 2023 -0300 configure: Use -Wno-restrict iff compiler supports it Diff: --- configure | 24 ++++++++++++++++++++++++ configure.ac | 8 ++++++++ libio/Makefile | 4 ++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/configure b/configure index f593aeb9fe..52c049c0ba 100755 --- a/configure +++ b/configure @@ -7316,6 +7316,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 8782cf8729..e8735c3b0b 100644 --- a/configure.ac +++ b/configure.ac @@ -1451,6 +1451,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 287ec11338..549912a06c 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