mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Cast result of copyObject() to correct type
copyObject() is declared to return void *, which allows easily assigning the result independent of the input, but it loses all type checking. If the compiler supports typeof or something similar, cast the result to the input type. This creates a greater amount of type safety. In some cases, where the result is assigned to a generic type such as Node * or Expr *, new casts are now necessary, but in general casts are now unnecessary in the normal case and indicate that something unusual is happening. Reviewed-by: Mark Dilger <hornschnorter@gmail.com>
This commit is contained in:
40
configure
vendored
40
configure
vendored
@ -11667,6 +11667,46 @@ if test x"$pgac_cv__static_assert" = xyes ; then
|
||||
|
||||
$as_echo "#define HAVE__STATIC_ASSERT 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for typeof" >&5
|
||||
$as_echo_n "checking for typeof... " >&6; }
|
||||
if ${pgac_cv_c_typeof+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
pgac_cv_c_typeof=no
|
||||
for pgac_kw in typeof __typeof__ decltype; do
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int x = 0;
|
||||
$pgac_kw(x) y;
|
||||
y = x;
|
||||
return y;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
pgac_cv_c_typeof=$pgac_kw
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
test "$pgac_cv_c_typeof" != no && break
|
||||
done
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_c_typeof" >&5
|
||||
$as_echo "$pgac_cv_c_typeof" >&6; }
|
||||
if test "$pgac_cv_c_typeof" != no; then
|
||||
|
||||
$as_echo "#define HAVE_TYPEOF 1" >>confdefs.h
|
||||
|
||||
if test "$pgac_cv_c_typeof" != typeof; then
|
||||
|
||||
$as_echo "#define typeof \$pgac_cv_c_typeof" >>confdefs.h
|
||||
|
||||
fi
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_types_compatible_p" >&5
|
||||
$as_echo_n "checking for __builtin_types_compatible_p... " >&6; }
|
||||
|
Reference in New Issue
Block a user