From: Florian Weimer Date: Tue, 27 May 2025 05:14:58 +0000 (+0200) Subject: Turn on -Wmissing-parameter-name by default if available X-Git-Tag: glibc-2.42~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03da41d47dc73674307e6ffc5b75e9043febc698;p=thirdparty%2Fglibc.git Turn on -Wmissing-parameter-name by default if available This flags another hazard for backporting changes to earlier branches. Reviewed-by: Sam James --- diff --git a/Makeconfig b/Makeconfig index d5ca908df4..fddd0329eb 100644 --- a/Makeconfig +++ b/Makeconfig @@ -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 diff --git a/configure b/configure index c8fd47caae..efc9203dda 100755 --- 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) diff --git a/configure.ac b/configure.ac index 6cf66c82a1..6d00b473e8 100644 --- a/configure.ac +++ b/configure.ac @@ -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)