Skip to content

Commit 6e2552d

Browse files
committed
Disable clang 16's -Wcast-function-type-strict.
This is a back-patch of commit 101c37c into REL_14_STABLE and REL_15_STABLE. Those branches had commit de8feb1, 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 <tgl@sss.pgh.pa.us> 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
1 parent aee8c2b commit 6e2552d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

configure

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6533,6 +6533,50 @@ fi
65336533
if test -n "$NOT_THE_CFLAGS"; then
65346534
CFLAGS="$CFLAGS -Wno-stringop-truncation"
65356535
fi
6536+
# Suppress clang 16's strict warnings about function casts
6537+
NOT_THE_CFLAGS=""
6538+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS" >&5
6539+
$as_echo_n "checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... " >&6; }
6540+
if ${pgac_cv_prog_CC_cflags__Wcast_function_type_strict+:} false; then :
6541+
$as_echo_n "(cached) " >&6
6542+
else
6543+
pgac_save_CFLAGS=$CFLAGS
6544+
pgac_save_CC=$CC
6545+
CC=${CC}
6546+
CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
6547+
ac_save_c_werror_flag=$ac_c_werror_flag
6548+
ac_c_werror_flag=yes
6549+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6550+
/* end confdefs.h. */
6551+
6552+
int
6553+
main ()
6554+
{
6555+
6556+
;
6557+
return 0;
6558+
}
6559+
_ACEOF
6560+
if ac_fn_c_try_compile "$LINENO"; then :
6561+
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=yes
6562+
else
6563+
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=no
6564+
fi
6565+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6566+
ac_c_werror_flag=$ac_save_c_werror_flag
6567+
CFLAGS="$pgac_save_CFLAGS"
6568+
CC="$pgac_save_CC"
6569+
fi
6570+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&5
6571+
$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&6; }
6572+
if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" = x"yes"; then
6573+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
6574+
fi
6575+
6576+
6577+
if test -n "$NOT_THE_CFLAGS"; then
6578+
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
6579+
fi
65366580
elif test "$ICC" = yes; then
65376581
# Intel's compiler has a bug/misoptimization in checking for
65386582
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,12 @@ if test "$GCC" = yes -a "$ICC" = no; then
563563
if test -n "$NOT_THE_CFLAGS"; then
564564
CFLAGS="$CFLAGS -Wno-stringop-truncation"
565565
fi
566+
# Suppress clang 16's strict warnings about function casts
567+
NOT_THE_CFLAGS=""
568+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcast-function-type-strict])
569+
if test -n "$NOT_THE_CFLAGS"; then
570+
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
571+
fi
566572
elif test "$ICC" = yes; then
567573
# Intel's compiler has a bug/misoptimization in checking for
568574
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

0 commit comments

Comments
 (0)