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 /src/include/pg_config.h.win32 | |
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 'src/include/pg_config.h.win32')
-rw-r--r-- | src/include/pg_config.h.win32 | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 81604de7f9..ab9b941e89 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -681,22 +681,20 @@ #define inline __inline #endif -/* Define to the equivalent of the C99 'restrict' keyword, or to - nothing if this is not supported. Do not define if restrict is - supported directly. */ -/* Visual Studio 2008 and upwards */ +/* Define to keyword to use for C99 restrict support, or to nothing if this is + not supported */ +/* Works for C and C++ in Visual Studio 2008 and upwards */ #if (_MSC_VER >= 1500) -/* works for C and C++ in msvc */ -/* - * Temporary attempt at a workaround for stdlib.h's use of - * declspec(restrict), conflicting with below define. - */ -#include <stdlib.h> -#define restrict __restrict +#define pg_restrict __restrict #else -#define restrict +#define pg_restrict #endif +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +/* not defined, because it'd conflict with __declspec(restrict) */ + /* Define to empty if the C compiler does not understand signed types. */ /* #undef signed */ |