diff options
author | Andres Freund <andres@anarazel.de> | 2017-10-12 15:25:38 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-10-12 16:17:35 -0700 |
commit | 91d5f1a4a3e8aea2a6488243bac55806160408fb (patch) | |
tree | df46b88f83af171650e73490749fe52aee20bffd /configure.in | |
parent | 1c497fa72df7593d8976653538da3d0ab033207f (diff) | |
download | postgresql-91d5f1a4a3e8aea2a6488243bac55806160408fb.tar.gz |
Use C99 restrict via pg_restrict, rather than restrict directly.
Unfortunately using 'restrict' plainly causes problems with MSVC,
which supports restrict only as '__restrict'. Defining 'restrict' to
'__restrict' unfortunately causes a conflict with MSVC's usage of
__declspec(restrict) in headers.
Therefore define pg_restrict to the appropriate keyword instead, and
replace existing usages.
This replaces the temporary workaround introduced in 36b4b91ba078.
Author: Andres Freund
Discussion: https://postgr.es/m/2656.1507830907@sss.pgh.pa.us
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/configure.in b/configure.in index ab990d69f4..32bb7bf940 100644 --- a/configure.in +++ b/configure.in @@ -1299,7 +1299,6 @@ fi m4_defun([AC_PROG_CC_STDC], []) dnl We don't want that. AC_C_BIGENDIAN AC_C_INLINE -AC_C_RESTRICT PGAC_PRINTF_ARCHETYPE AC_C_FLEXIBLE_ARRAY_MEMBER PGAC_C_SIGNED @@ -1326,6 +1325,20 @@ AC_TYPE_LONG_LONG_INT PGAC_TYPE_LOCALE_T +# MSVC doesn't cope well with defining restrict to __restrict, the +# spelling it understands, because it conflicts with +# __declspec(restrict). Therefore we define pg_restrict to the +# appropriate definition, which presumably won't conflict. +AC_C_RESTRICT +if test "$ac_cv_c_restrict" = "no" ; then + pg_restrict="" +else + pg_restrict="$ac_cv_c_restrict" +fi +AC_DEFINE_UNQUOTED([pg_restrict], [$pg_restrict], +[Define to keyword to use for C99 restrict support, or to nothing if not +supported]) + AC_CHECK_TYPES([struct cmsgcred], [], [], [#include <sys/socket.h> #include <sys/param.h> |