aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2017-10-11 16:01:52 -0700
committerAndres Freund <andres@anarazel.de>2017-10-11 16:01:52 -0700
commit0b974dba2d6b5581ce422ed883209de46f313fb6 (patch)
tree06b01bcde101a73e3211b5930ea3e259b4c3c134 /src
parent5fa6b0d102eb8ccd15c4963ee9841baec50df45e (diff)
downloadpostgresql-0b974dba2d6b5581ce422ed883209de46f313fb6.tar.gz
postgresql-0b974dba2d6b5581ce422ed883209de46f313fb6.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/include/pg_config.h.in14
-rw-r--r--src/include/pg_config.h.win3211
2 files changed, 25 insertions, 0 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index b0298cca19c..80ee37dd622 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -923,6 +923,20 @@
if such a type exists, and if the system does not define it. */
#undef intptr_t
+/* 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. */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+ __restrict__, even though the corresponding Sun C compiler ends up with
+ "#define restrict _Restrict" or "#define restrict __restrict__" in the
+ previous line. Perhaps some future version of Sun C++ will work with
+ restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
/* Define to empty if the C compiler does not understand signed types. */
#undef signed
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index b76aad02676..3be1c235aaa 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -681,6 +681,17 @@
#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 */
+#if (_MSC_VER >= 1500)
+/* works for C and C++ in msvc */
+#define restrict __restrict
+#else
+#define restrict
+#endif
+
/* Define to empty if the C compiler does not understand signed types. */
/* #undef signed */