Don't pass -c to LIBC_TRY_TEST_CC_OPTION

LIBC_TRY_TEST_CC_OPTION is defined with LIBC_TRY_CC_OPTION:

dnl Test a compiler option or options with an empty input file.
dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
AC_DEFUN([LIBC_TRY_CC_OPTION],
[AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
        [$2], [$3])])

which passes -S to compiler.  Unlike gcc, when -c is also passed to clang
20, we get

configure:7838: clang -c -Werror -fsemantic-interposition -xc /dev/null -S -o /dev/null
clang: error: argument unused during compilation: '-c' [-Werror,-Wunused-command-line-argument]

Don't pass -c to LIBC_TRY_TEST_CC_OPTION since -c isn't needed.

This fixes BZ #33318.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
H.J. Lu 2025-08-23 07:04:48 -07:00
parent 7851260bf5
commit 027505a07b
4 changed files with 12 additions and 12 deletions

10
configure vendored
View File

@ -7834,7 +7834,7 @@ if test ${libc_cv_test_cc_cflags_fsemantic_interposition+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if { ac_try='${CC-cc} -c -Werror -fsemantic-interposition -xc /dev/null -S -o /dev/null'
e) if { ac_try='${CC-cc} -Werror -fsemantic-interposition -xc /dev/null -S -o /dev/null'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
@ -8204,7 +8204,7 @@ 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 -Wno-restrict -xc /dev/null -S -o /dev/null'
e) 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=$?
@ -8238,7 +8238,7 @@ if test ${libc_cv_test_cflags_wno_fortify_source+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if { ac_try='${CC-cc} -c -Werror -Wno-fortify-source -xc /dev/null -S -o /dev/null'
e) if { ac_try='${CC-cc} -Werror -Wno-fortify-source -xc /dev/null -S -o /dev/null'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
@ -8272,7 +8272,7 @@ if test ${libc_cv_test_cflags_finput_charset_ascii+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'
e) if { ac_try='${CC-cc} -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=$?
@ -8306,7 +8306,7 @@ if test ${libc_cv_test_cxxflags_finput_charset_ascii+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if { ac_try='${CXX-c++} -c -Werror -finput-charset=ascii -xc++ /dev/null -S -o /dev/null'
e) if { ac_try='${CXX-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=$?

View File

@ -1543,7 +1543,7 @@ AC_SUBST(libc_cv_test_cc_signaling_nans)
dnl Check if TEST_CC supports -fsemantic-interposition.
LIBC_TRY_TEST_CC_OPTION([-fsemantic-interposition],
[-c -Werror -fsemantic-interposition],
[-Werror -fsemantic-interposition],
libc_cv_test_cc_cflags_fsemantic_interposition,
[libc_cv_test_cc_cflags_fsemantic_interposition=yes],
[libc_cv_test_cc_cflags_fsemantic_interposition=no]
@ -1649,7 +1649,7 @@ LIBC_CONFIG_VAR([have-test-cc-trampoline],
dnl Check if TEST_CC supports -Wno-restrict.
LIBC_TRY_TEST_CC_OPTION([-Wno-restrict],
[-c -Werror -Wno-restrict],
[-Werror -Wno-restrict],
libc_cv_test_cflags_wno_restrict,
[libc_cv_test_cflags_wno_restrict=-Wno-restrict],
[libc_cv_test_cflags_wno_restrict=]
@ -1659,7 +1659,7 @@ LIBC_CONFIG_VAR([test-config-cflags-wno-restrict],
dnl Check if TEST_CC supports -Wno-fortify-source.
LIBC_TRY_TEST_CC_OPTION([-Wno-fortify-source],
[-c -Werror -Wno-fortify-source],
[-Werror -Wno-fortify-source],
libc_cv_test_cflags_wno_fortify_source,
[libc_cv_test_cflags_wno_fortify_source=-Wno-fortify-source],
[libc_cv_test_cflags_wno_fortify_source=]
@ -1669,7 +1669,7 @@ LIBC_CONFIG_VAR([test-config-cflags-wno-fortify-source],
dnl Check if TEST_CC supports -finput-charset=ascii.
LIBC_TRY_TEST_CC_OPTION([-finput-charset=ascii],
[-c -Werror -finput-charset=ascii],
[-Werror -finput-charset=ascii],
libc_cv_test_cflags_finput_charset_ascii,
[libc_cv_test_cflags_finput_charset_ascii="-finput-charset=ascii"],
[libc_cv_test_cflags_finput_charset_ascii=]
@ -1679,7 +1679,7 @@ LIBC_CONFIG_VAR(test-config-cflags-finput-charset-ascii,
dnl Check if TEST_CXX supports -finput-charset=ascii.
LIBC_TRY_TEST_CXX_OPTION([$CXX -finput-charset=ascii],
[-c -Werror -finput-charset=ascii],
[-Werror -finput-charset=ascii],
libc_cv_test_cxxflags_finput_charset_ascii,
[libc_cv_test_cxxflags_finput_charset_ascii="-finput-charset=ascii"],
[libc_cv_test_cxxflags_finput_charset_ascii=]

View File

@ -189,7 +189,7 @@ if test ${libc_cv_have_test_cc_cflags_mfpmath_387+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) if { ac_try='${CC-cc} -c -Werror -mfpmath=387 -xc /dev/null -S -o /dev/null'
e) if { ac_try='${CC-cc} -Werror -mfpmath=387 -xc /dev/null -S -o /dev/null'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?

View File

@ -124,7 +124,7 @@ LIBC_CONFIG_VAR([enable-x86-isa-level], [$libc_cv_include_x86_isa_level])
dnl Check if TEST_CC supports -mfpmath=387
LIBC_TRY_TEST_CC_OPTION([if -mfpmath=387 works],
[-c -Werror -mfpmath=387],
[-Werror -mfpmath=387],
libc_cv_have_test_cc_cflags_mfpmath_387,
[libc_cv_have_test_cc_cflags_mfpmath_387=yes],
[libc_cv_have_test_cc_cflags_mfpmath_387=no]