Skip to content

Commit 2783112

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 f7d3caf commit 2783112

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
@@ -6518,6 +6518,50 @@ fi
65186518
if test -n "$NOT_THE_CFLAGS"; then
65196519
CFLAGS="$CFLAGS -Wno-stringop-truncation"
65206520
fi
6521+
# Suppress clang 16's strict warnings about function casts
6522+
NOT_THE_CFLAGS=""
6523+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS" >&5
6524+
$as_echo_n "checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... " >&6; }
6525+
if ${pgac_cv_prog_CC_cflags__Wcast_function_type_strict+:} false; then :
6526+
$as_echo_n "(cached) " >&6
6527+
else
6528+
pgac_save_CFLAGS=$CFLAGS
6529+
pgac_save_CC=$CC
6530+
CC=${CC}
6531+
CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
6532+
ac_save_c_werror_flag=$ac_c_werror_flag
6533+
ac_c_werror_flag=yes
6534+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6535+
/* end confdefs.h. */
6536+
6537+
int
6538+
main ()
6539+
{
6540+
6541+
;
6542+
return 0;
6543+
}
6544+
_ACEOF
6545+
if ac_fn_c_try_compile "$LINENO"; then :
6546+
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=yes
6547+
else
6548+
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=no
6549+
fi
6550+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6551+
ac_c_werror_flag=$ac_save_c_werror_flag
6552+
CFLAGS="$pgac_save_CFLAGS"
6553+
CC="$pgac_save_CC"
6554+
fi
6555+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&5
6556+
$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&6; }
6557+
if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" = x"yes"; then
6558+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
6559+
fi
6560+
6561+
6562+
if test -n "$NOT_THE_CFLAGS"; then
6563+
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
6564+
fi
65216565
elif test "$ICC" = yes; then
65226566
# Intel's compiler has a bug/misoptimization in checking for
65236567
# 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
@@ -560,6 +560,12 @@ if test "$GCC" = yes -a "$ICC" = no; then
560560
if test -n "$NOT_THE_CFLAGS"; then
561561
CFLAGS="$CFLAGS -Wno-stringop-truncation"
562562
fi
563+
# Suppress clang 16's strict warnings about function casts
564+
NOT_THE_CFLAGS=""
565+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcast-function-type-strict])
566+
if test -n "$NOT_THE_CFLAGS"; then
567+
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
568+
fi
563569
elif test "$ICC" = yes; then
564570
# Intel's compiler has a bug/misoptimization in checking for
565571
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

0 commit comments

Comments
 (0)