diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/libpq/pqformat.h | 24 | ||||
-rw-r--r-- | src/include/pg_config.h.in | 4 | ||||
-rw-r--r-- | src/include/pg_config.h.win32 | 22 |
3 files changed, 26 insertions, 24 deletions
diff --git a/src/include/libpq/pqformat.h b/src/include/libpq/pqformat.h index 2329669b085..35cdee7b76f 100644 --- a/src/include/libpq/pqformat.h +++ b/src/include/libpq/pqformat.h @@ -38,8 +38,8 @@ extern void pq_sendfloat8(StringInfo buf, float8 f); * Append a int8 to a StringInfo buffer, which already has enough space * preallocated. * - * The use of restrict allows the compiler to optimize the code based on the - * assumption that buf, buf->len, buf->data and *buf->data don't + * The use of pg_restrict allows the compiler to optimize the code based on + * the assumption that buf, buf->len, buf->data and *buf->data don't * overlap. Without the annotation buf->len etc cannot be kept in a register * over subsequent pq_writeint* calls. * @@ -47,12 +47,12 @@ extern void pq_sendfloat8(StringInfo buf, float8 f); * overly picky and demanding a * before a restrict. */ static inline void -pq_writeint8(StringInfoData * restrict buf, int8 i) +pq_writeint8(StringInfoData *pg_restrict buf, int8 i) { int8 ni = i; Assert(buf->len + sizeof(i) <= buf->maxlen); - memcpy((char *restrict) (buf->data + buf->len), &ni, sizeof(ni)); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(ni)); buf->len += sizeof(i); } @@ -61,12 +61,12 @@ pq_writeint8(StringInfoData * restrict buf, int8 i) * preallocated. */ static inline void -pq_writeint16(StringInfoData * restrict buf, int16 i) +pq_writeint16(StringInfoData *pg_restrict buf, int16 i) { int16 ni = pg_hton16(i); Assert(buf->len + sizeof(ni) <= buf->maxlen); - memcpy((char *restrict) (buf->data + buf->len), &ni, sizeof(i)); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(i)); buf->len += sizeof(i); } @@ -75,12 +75,12 @@ pq_writeint16(StringInfoData * restrict buf, int16 i) * preallocated. */ static inline void -pq_writeint32(StringInfoData * restrict buf, int32 i) +pq_writeint32(StringInfoData *pg_restrict buf, int32 i) { int32 ni = pg_hton32(i); Assert(buf->len + sizeof(i) <= buf->maxlen); - memcpy((char *restrict) (buf->data + buf->len), &ni, sizeof(i)); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(i)); buf->len += sizeof(i); } @@ -89,12 +89,12 @@ pq_writeint32(StringInfoData * restrict buf, int32 i) * preallocated. */ static inline void -pq_writeint64(StringInfoData * restrict buf, int64 i) +pq_writeint64(StringInfoData *pg_restrict buf, int64 i) { int64 ni = pg_hton64(i); Assert(buf->len + sizeof(i) <= buf->maxlen); - memcpy((char *restrict) (buf->data + buf->len), &ni, sizeof(i)); + memcpy((char *pg_restrict) (buf->data + buf->len), &ni, sizeof(i)); buf->len += sizeof(i); } @@ -109,7 +109,7 @@ pq_writeint64(StringInfoData * restrict buf, int64 i) * sent to the frontend. */ static inline void -pq_writestring(StringInfoData * restrict buf, const char *restrict str) +pq_writestring(StringInfoData *pg_restrict buf, const char *pg_restrict str) { int slen = strlen(str); char *p; @@ -120,7 +120,7 @@ pq_writestring(StringInfoData * restrict buf, const char *restrict str) Assert(buf->len + slen + 1 <= buf->maxlen); - memcpy(((char *restrict) buf->data + buf->len), p, slen + 1); + memcpy(((char *pg_restrict) buf->data + buf->len), p, slen + 1); buf->len += slen + 1; if (p != str) diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 80ee37dd622..cfdcc5ac62f 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -923,6 +923,10 @@ if such a type exists, and if the system does not define it. */ #undef intptr_t +/* Define to keyword to use for C99 restrict support, or to nothing if not + supported */ +#undef pg_restrict + /* 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. */ diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 81604de7f92..ab9b941e89d 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 */ |