[PATCH 27/39] Check if TEST_CC supports -Wno-restrict before using it
H.J. Lu
hjl.tools@gmail.com
Sun Dec 22 20:32:04 GMT 2024
On Sun, Dec 22, 2024 at 12:49 PM Sam James <sam@gentoo.org> wrote:
>
> "H.J. Lu" <hjl.tools@gmail.com> writes:
>
> > From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> >
> > Check if TEST_CC supports -Wno-restrict before using it to avoid Clang
> > error:
> >
> > error: unknown warning option '-Wno-restrict' [-Werror,-Wunknown-warning-option]
> >
> > Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
> > ---
> > configure | 34 ++++++++++++++++++++++++++++++++++
> > configure.ac | 10 ++++++++++
> > libio/Makefile | 6 ++++--
> > 3 files changed, 48 insertions(+), 2 deletions(-)
> >
> > diff --git a/configure b/configure
> > index f5e8096099..04b21f0308 100755
> > --- a/configure
> > +++ b/configure
> > @@ -7968,6 +7968,40 @@ have-test-cc-trampoline = $libc_cv_test_cc_trampolines"
> >
> >
> >
> > +saved_CC="$CC"
> > +CC="$TEST_CC"
> > +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -Wno-restrict in testing" >&5
> > +printf %s "checking -Wno-restrict in testing... " >&6; }
> > +if test ${libc_cv_test_cflags_wno_restrict+y}
> > +then :
> > + printf %s "(cached) " >&6
> > +else case e in #(
> > + e) if { ac_try='${CC-cc} -c -Werror -finput-charset=ascii -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_test_cflags_wno_restrict=-Wno-restrict
> > +else case e in #(
> > + e) libc_cv_test_cflags_wno_restrict=
> > + ;;
> > +esac
> > +fi ;;
> > +esac
> > +fi
> > +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cflags_wno_restrict" >&5
> > +printf "%s\n" "$libc_cv_test_cflags_wno_restrict" >&6; }
> > +
> > +CC="$saved_CC"
> > +
> > +
> > +config_vars="$config_vars
> > +test-config-cflags-wno-restrict = $libc_cv_test_cflags_wno_restrict"
> > +
> > +
> > +
> > saved_CC="$CC"
> > CC="$TEST_CC"
> > { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking -finput-charset=ascii in testing" >&5
> > diff --git a/configure.ac b/configure.ac
> > index e331557350..a5445f0b05 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1580,6 +1580,16 @@ LIBC_TRY_TEST_CC_COMMAND([support for trampolines],
> > LIBC_CONFIG_VAR([have-test-cc-trampoline],
> > [$libc_cv_test_cc_trampolines])
> >
> > +dnl Check if TEST_CC supports -Wno-restrict.
> > +LIBC_TRY_TEST_CC_OPTION([-Wno-restrict],
> > + [-c -Werror -finput-charset=ascii],
>
> Typo?
>
> With just that fixed:
> Reviewed-by: Sam James <sam@gentoo.org>
Fixed. This is what I am checking in.
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-if-TEST_CC-supports-Wno-restrict-before-using-.patch
Type: text/x-patch
Size: 3420 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20241223/8a38f50c/attachment-0001.bin>
More information about the Libc-alpha
mailing list