[PATCH 44/59] Supress unused command arguments warning with clang
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Oct 17 19:13:19 GMT 2025
clang 20 triggers an error for the unused '-c' argument used to create
errlist-data-aux-shared.S, errlist-data-aux.S, siglist-aux-shared.S,
and siglist-aux.S.
---
configure | 26 ++++++++++++++++++++++++++
configure.ac | 9 +++++++++
stdio-common/Makefile | 16 ++++++++++++----
3 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 789f68da75..38e7d820c5 100755
--- a/configure
+++ b/configure
@@ -7639,6 +7639,32 @@ 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-unused-command-line-argument" >&5
+printf %s "checking for -Wno-unused-command-line-argument... " >&6; }
+if test ${libc_cv_wno_unused_command_line_argument+y}
+then :
+ printf %s "(cached) " >&6
+else case e in #(
+ e) if { ac_try='${CC-cc} -Werror -Wunused-command-line-argument -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_unused_command_line_argument=-Wno-unused-command-line-argument
+else case e in #(
+ e) libc_cv_wno_unused_command_line_argument= ;;
+esac
+fi
+ ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_wno_unused_command_line_argument" >&5
+printf "%s\n" "$libc_cv_wno_unused_command_line_argument" >&6; }
+config_vars="$config_vars
+config-cflags-wno-unused-command-line-arguments = $libc_cv_wno_unused_command_line_argument"
+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether cc puts quotes around section names" >&5
printf %s "checking whether cc puts quotes around section names... " >&6; }
if test ${libc_cv_have_section_quotes+y}
diff --git a/configure.ac b/configure.ac
index aa4641edae..0a6badeb19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1453,6 +1453,15 @@ AC_CACHE_CHECK([for -Wno-maybe-uninitialized],
LIBC_CONFIG_VAR([config-cflags-wno-maybe-uninitialized],
[$libc_cv_wno_maybe_uninitialized])
+AC_CACHE_CHECK([for -Wno-unused-command-line-argument],
+ libc_cv_wno_unused_command_line_argument, [dnl
+ LIBC_TRY_CC_OPTION([-Werror -Wunused-command-line-argument],
+ [libc_cv_wno_unused_command_line_argument=-Wno-unused-command-line-argument],
+ [libc_cv_wno_unused_command_line_argument=])
+])
+LIBC_CONFIG_VAR([config-cflags-wno-unused-command-line-arguments],
+ [$libc_cv_wno_unused_command_line_argument])
+
AC_CACHE_CHECK(whether cc puts quotes around section names,
libc_cv_have_section_quotes,
[cat > conftest.c <<EOF
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index 8da164695f..fba6bd99fd 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -497,11 +497,15 @@ include ../Rules
# than 2.29 it might generate object sizes different than the expected ones.
$(objpfx)errlist-data-aux-shared.S: errlist-data-gen.c
$(make-target-directory)
- $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
+ $(compile-command.c) \
+ $(config-cflags-wno-unused-command-line-arguments) \
+ $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
$(objpfx)errlist-data-aux.S: errlist-data-gen.c
$(make-target-directory)
- $(compile-command.c) $(pie-default) $(no-stack-protector) -S
+ $(compile-command.c) \
+ $(config-cflags-wno-unused-command-line-arguments) \
+ $(pie-default) $(no-stack-protector) -S
ifndef no_deps
-include $(objpfx)errlist-data-aux.S.d $(objpfx)errlist-data-aux-shared.S.d
@@ -513,11 +517,15 @@ $(addprefix $(objpfx)errlist-data, $(object-suffixes-noshared)): \
$(objpfx)siglist-aux-shared.S: siglist-gen.c
$(make-target-directory)
- $(compile-command.c) $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
+ $(compile-command.c) \
+ $(config-cflags-wno-unused-command-line-arguments) \
+ $(pic-cppflags) $(pic-ccflag) $(no-stack-protector) -S
$(objpfx)siglist-aux.S: siglist-gen.c
$(make-target-directory)
- $(compile-command.c) $(pie-default) $(no-stack-protector) -S
+ $(compile-command.c) \
+ $(config-cflags-wno-unused-command-line-arguments) \
+ $(pie-default) $(no-stack-protector) -S
ifndef no_deps
-include $(objpfx)siglist-aux.S.d $(objpfx)siglist-aux-shared.S.d
--
2.43.0
More information about the Libc-alpha
mailing list