[PATCH] Don't pass -c to LIBC_TRY_TEST_CC_OPTION
H.J. Lu
hjl.tools@gmail.com
Sat Aug 23 14:04:48 GMT 2025
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>
---
configure | 10 +++++-----
configure.ac | 10 +++++-----
sysdeps/x86/configure | 2 +-
sysdeps/x86/configure.ac | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/configure b/configure
index 613ebe670a..222f04db22 100755
--- a/configure
+++ b/configure
@@ -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=$?
diff --git a/configure.ac b/configure.ac
index 6aefff94a2..af57b0cbae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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=]
diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure
index f495f69894..b8583e266b 100644
--- a/sysdeps/x86/configure
+++ b/sysdeps/x86/configure
@@ -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=$?
diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac
index 77ba6721ec..07f62d0616 100644
--- a/sysdeps/x86/configure.ac
+++ b/sysdeps/x86/configure.ac
@@ -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]
--
2.50.1
More information about the Libc-alpha
mailing list