]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Turn on -Wmissing-parameter-name by default if available
authorFlorian Weimer <fweimer@redhat.com>
Tue, 27 May 2025 05:14:58 +0000 (07:14 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 27 May 2025 05:15:06 +0000 (07:15 +0200)
This flags another hazard for backporting changes to earlier branches.

Reviewed-by: Sam James <sam@gentoo.org>
Makeconfig
configure
configure.ac

index d5ca908df4badc428108f631229763765d8279e2..fddd0329eb5b92a8b1111644a5cda6dfcea1fb25 100644 (file)
@@ -893,7 +893,7 @@ endif
 
 # Extra flags to pass to GCC.
 +gccwarn := -Wall -Wwrite-strings -Wundef $(cc-option-wimplicit-fallthrough) \
-  $(cc-option-wfree-labels)
+  $(cc-option-wfree-labels) $(cc-option-wmissing-parameter-name)
 ifeq ($(enable-werror),yes)
 +gccwarn += -Werror
 endif
index c8fd47caae4e0e00ba3bd203b6cf80a324bf3743..efc9203dda352f88698853820c978fbccad831fb 100755 (executable)
--- a/configure
+++ b/configure
@@ -649,6 +649,7 @@ have_selinux
 have_libcap
 have_libaudit
 LIBGD
+libc_cv_test_cc_wmissing_parameter_name
 libc_cv_test_cc_wfree_labels
 libc_cv_test_cc_wimplicit_fallthrough
 libc_cv_cc_loop_to_function
@@ -8029,6 +8030,66 @@ config_vars="$config_vars
 cc-option-wfree-labels = $libc_cv_cc_wfree_labels"
 
 
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -Wmissing-parameter-name" >&5
+printf %s "checking for -Wmissing-parameter-name... " >&6; }
+if test ${libc_cv_cc_wmissing_parameter_name+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if { ac_try='${CC-cc} -Werror -Wmissing-parameter-name -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_cc_wmissing_parameter_name=-Wmissing-parameter-name
+else case e in #(
+  e) libc_cv_cc_wmissing_parameter_name= ;;
+esac
+fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_wmissing_parameter_name" >&5
+printf "%s\n" "$libc_cv_cc_wmissing_parameter_name" >&6; }
+if test "$TEST_CC" = "$CC"; then
+  libc_cv_test_cc_wmissing_parameter_name=$libc_cv_cc_wmissing_parameter_name
+else
+
+saved_CC="$CC"
+CC="$TEST_CC"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -Wmissing-parameter-name in testing" >&5
+printf %s "checking for -Wmissing-parameter-name in testing... " >&6; }
+if test ${libc_cv_test_cc_wmissing_parameter_name+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if { ac_try='${CC-cc} -Werror -Wmissing-parameter-name -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_cc_wmissing_parameter_name=-Wmissing-parameter-name
+else case e in #(
+  e) libc_cv_test_cc_wmissing_parameter_name= ;;
+esac
+fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cc_wmissing_parameter_name" >&5
+printf "%s\n" "$libc_cv_test_cc_wmissing_parameter_name" >&6; }
+
+CC="$saved_CC"
+
+fi
+
+config_vars="$config_vars
+cc-option-wmissing-parameter-name = $libc_cv_cc_wmissing_parameter_name"
+
+
 conftest_code="
 void bar (void (*callback) (void));
 int foo (void)
index 6cf66c82a136c8a57fdc851d9131ff9d05f5fbfb..6d00b473e8f0d5c3c9ae08eee88e958a90b665d4 100644 (file)
@@ -1586,6 +1586,18 @@ LIBC_TRY_CC_AND_TEST_CC_OPTION([for -Wfree-labels],
 LIBC_CONFIG_VAR([cc-option-wfree-labels], [$libc_cv_cc_wfree_labels])
 AC_SUBST(libc_cv_test_cc_wfree_labels)
 
+LIBC_TRY_CC_AND_TEST_CC_OPTION([for -Wmissing-parameter-name],
+  [-Werror -Wmissing-parameter-name],
+  libc_cv_cc_wmissing_parameter_name,
+  [libc_cv_cc_wmissing_parameter_name=-Wmissing-parameter-name],
+  [libc_cv_cc_wmissing_parameter_name=],
+  libc_cv_test_cc_wmissing_parameter_name,
+  [libc_cv_test_cc_wmissing_parameter_name=-Wmissing-parameter-name],
+  [libc_cv_test_cc_wmissing_parameter_name=])
+LIBC_CONFIG_VAR([cc-option-wmissing-parameter-name],
+               [$libc_cv_cc_wmissing_parameter_name])
+AC_SUBST(libc_cv_test_cc_wmissing_parameter_name)
+
 conftest_code="
 void bar (void (*callback) (void));
 int foo (void)