From 27831127d641b3065bd238ed513def452baeea80 Mon Sep 17 00:00:00 2001 From: Thomas Munro Date: Tue, 13 Dec 2022 10:03:28 +1300 Subject: [PATCH] Disable clang 16's -Wcast-function-type-strict. This is a back-patch of commit 101c37cd into REL_14_STABLE and REL_15_STABLE. Those branches had commit de8feb1f3, which turned on -Wcast-function-type, but did not disable -Wcast-function-type-strict. This silences warnings about function pointer types without prototypes based on new C23 rules, that we want to suppress for now. Reviewed-by: Tom Lane Discussion: https://postgr.es/m/CA%2BhUKGKnBvdrbH2LW%2B7-Lv599t9JFOHjx%3Dxw-VQmdoj%3D9585CQ%40mail.gmail.com Discussion: https://postgr.es/m/CA%2BhUKGJvX%2BL3aMN84ksT-cGy08VHErRNip3nV-WmTx7f6Pqhyw%40mail.gmail.com --- configure | 44 ++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 6 ++++++ 2 files changed, 50 insertions(+) diff --git a/configure b/configure index 350b8a56b6e..e065cbf64c0 100755 --- a/configure +++ b/configure @@ -6518,6 +6518,50 @@ fi if test -n "$NOT_THE_CFLAGS"; then CFLAGS="$CFLAGS -Wno-stringop-truncation" fi + # Suppress clang 16's strict warnings about function casts + NOT_THE_CFLAGS="" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS" >&5 +$as_echo_n "checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... " >&6; } +if ${pgac_cv_prog_CC_cflags__Wcast_function_type_strict+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +pgac_save_CC=$CC +CC=${CC} +CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict" +ac_save_c_werror_flag=$ac_c_werror_flag +ac_c_werror_flag=yes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_CC_cflags__Wcast_function_type_strict=yes +else + pgac_cv_prog_CC_cflags__Wcast_function_type_strict=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=$ac_save_c_werror_flag +CFLAGS="$pgac_save_CFLAGS" +CC="$pgac_save_CC" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&5 +$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&6; } +if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" = x"yes"; then + NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict" +fi + + + if test -n "$NOT_THE_CFLAGS"; then + CFLAGS="$CFLAGS -Wno-cast-function-type-strict" + fi elif test "$ICC" = yes; then # Intel's compiler has a bug/misoptimization in checking for # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS. diff --git a/configure.ac b/configure.ac index 79adbbe74b2..9eb21e7c9bf 100644 --- a/configure.ac +++ b/configure.ac @@ -560,6 +560,12 @@ if test "$GCC" = yes -a "$ICC" = no; then if test -n "$NOT_THE_CFLAGS"; then CFLAGS="$CFLAGS -Wno-stringop-truncation" fi + # Suppress clang 16's strict warnings about function casts + NOT_THE_CFLAGS="" + PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcast-function-type-strict]) + if test -n "$NOT_THE_CFLAGS"; then + CFLAGS="$CFLAGS -Wno-cast-function-type-strict" + fi elif test "$ICC" = yes; then # Intel's compiler has a bug/misoptimization in checking for # division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS. -- 2.39.5