Skip to content

Commit b4363fc

Browse files
macdiceadunstan
authored andcommitted
Disable clang 16's -Wcast-function-type-strict.
Clang 16 is still in development, but seawasp reveals that it has started warning about many of our casts of function pointers (those introduced by commit 1c27d16, and some older ones). Disable the new warning for now, since otherwise buildfarm animal seawasp fails, and we have no current plans to change our strategy for these callback function types. May be back-patched with other Clang/LLVM 16 changes around release time. Discussion: https://postgr.es/m/CA%2BhUKGJvX%2BL3aMN84ksT-cGy08VHErRNip3nV-WmTx7f6Pqhyw%40mail.gmail.com (cherry picked from commit 101c37c) Author: Thomas Munro <tmunro@postgresql.org> Author: Alexandra Wang <alexandra.wang.oss@gmail.com>
1 parent a5abace commit b4363fc

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

configure

+44
Original file line numberDiff line numberDiff line change
@@ -6411,6 +6411,50 @@ fi
64116411
if test -n "$NOT_THE_CFLAGS"; then
64126412
CFLAGS="$CFLAGS -Wno-stringop-truncation"
64136413
fi
6414+
# Suppress clang 16's strict warnings about function casts
6415+
NOT_THE_CFLAGS=""
6416+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS" >&5
6417+
$as_echo_n "checking whether ${CC} supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... " >&6; }
6418+
if ${pgac_cv_prog_CC_cflags__Wcast_function_type_strict+:} false; then :
6419+
$as_echo_n "(cached) " >&6
6420+
else
6421+
pgac_save_CFLAGS=$CFLAGS
6422+
pgac_save_CC=$CC
6423+
CC=${CC}
6424+
CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
6425+
ac_save_c_werror_flag=$ac_c_werror_flag
6426+
ac_c_werror_flag=yes
6427+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6428+
/* end confdefs.h. */
6429+
6430+
int
6431+
main ()
6432+
{
6433+
6434+
;
6435+
return 0;
6436+
}
6437+
_ACEOF
6438+
if ac_fn_c_try_compile "$LINENO"; then :
6439+
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=yes
6440+
else
6441+
pgac_cv_prog_CC_cflags__Wcast_function_type_strict=no
6442+
fi
6443+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
6444+
ac_c_werror_flag=$ac_save_c_werror_flag
6445+
CFLAGS="$pgac_save_CFLAGS"
6446+
CC="$pgac_save_CC"
6447+
fi
6448+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&5
6449+
$as_echo "$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" >&6; }
6450+
if test x"$pgac_cv_prog_CC_cflags__Wcast_function_type_strict" = x"yes"; then
6451+
NOT_THE_CFLAGS="${NOT_THE_CFLAGS} -Wcast-function-type-strict"
6452+
fi
6453+
6454+
6455+
if test -n "$NOT_THE_CFLAGS"; then
6456+
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
6457+
fi
64146458
elif test "$ICC" = yes; then
64156459
# Intel's compiler has a bug/misoptimization in checking for
64166460
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

configure.in

+6
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,12 @@ if test "$GCC" = yes -a "$ICC" = no; then
553553
if test -n "$NOT_THE_CFLAGS"; then
554554
CFLAGS="$CFLAGS -Wno-stringop-truncation"
555555
fi
556+
# Suppress clang 16's strict warnings about function casts
557+
NOT_THE_CFLAGS=""
558+
PGAC_PROG_CC_VAR_OPT(NOT_THE_CFLAGS, [-Wcast-function-type-strict])
559+
if test -n "$NOT_THE_CFLAGS"; then
560+
CFLAGS="$CFLAGS -Wno-cast-function-type-strict"
561+
fi
556562
elif test "$ICC" = yes; then
557563
# Intel's compiler has a bug/misoptimization in checking for
558564
# division by NAN (NaN == 0), -mp1 fixes it, so add it to the CFLAGS.

meson.build

Whitespace-only changes.

0 commit comments

Comments
 (0)