mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Add configure infrastructure to detect support for C99's restrict.
Will be used in later commits improving performance for a few key routines where information about aliasing allows for significantly better code generation. This allows to use the C99 'restrict' keyword without breaking C89, or for that matter C++, compilers. If not supported it's defined to be empty. Author: Andres Freund Discussion: https://postgr.es/m/20170914063418.sckdzgjfrsbekae4@alap3.anarazel.de
This commit is contained in:
46
configure
vendored
46
configure
vendored
@ -11545,6 +11545,52 @@ _ACEOF
|
||||
;;
|
||||
esac
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
|
||||
$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
|
||||
if ${ac_cv_c_restrict+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_cv_c_restrict=no
|
||||
# The order here caters to the fact that C++ does not require restrict.
|
||||
for ac_kw in __restrict __restrict__ _Restrict restrict; do
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
typedef int * int_ptr;
|
||||
int foo (int_ptr $ac_kw ip) {
|
||||
return ip[0];
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int s[1];
|
||||
int * $ac_kw t = s;
|
||||
t[0] = 0;
|
||||
return foo(t)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_cv_c_restrict=$ac_kw
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
test "$ac_cv_c_restrict" != no && break
|
||||
done
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
|
||||
$as_echo "$ac_cv_c_restrict" >&6; }
|
||||
|
||||
case $ac_cv_c_restrict in
|
||||
restrict) ;;
|
||||
no) $as_echo "#define restrict /**/" >>confdefs.h
|
||||
;;
|
||||
*) cat >>confdefs.h <<_ACEOF
|
||||
#define restrict $ac_cv_c_restrict
|
||||
_ACEOF
|
||||
;;
|
||||
esac
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for printf format archetype" >&5
|
||||
$as_echo_n "checking for printf format archetype... " >&6; }
|
||||
if ${pgac_cv_printf_archetype+:} false; then :
|
||||
|
Reference in New Issue
Block a user