From 060b069984a69ff0255ce318f10681c553613bef Mon Sep 17 00:00:00 2001 From: Andres Freund Date: Wed, 11 Oct 2017 17:16:16 -0700 Subject: [PATCH] Work around overly strict restrict checks by MSVC. Apparently MSVC requires a * before a restrict in a variable declaration, even if the adorned type already is a pointer, just via typedef. As reported by buildfarm animal woodlouse. Author: Andres Freund Discussion: https://postgr.es/m/20171012001320.4putagiruuehtvb6@alap3.anarazel.de --- src/include/libpq/pqformat.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/include/libpq/pqformat.h b/src/include/libpq/pqformat.h index 9a546b4891..2329669b08 100644 --- a/src/include/libpq/pqformat.h +++ b/src/include/libpq/pqformat.h @@ -42,9 +42,12 @@ extern void pq_sendfloat8(StringInfo buf, float8 f); * 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. + * + * The use of StringInfoData * rather than StringInfo is due to MSVC being + * overly picky and demanding a * before a restrict. */ static inline void -pq_writeint8(StringInfo restrict buf, int8 i) +pq_writeint8(StringInfoData * restrict buf, int8 i) { int8 ni = i; @@ -58,7 +61,7 @@ pq_writeint8(StringInfo restrict buf, int8 i) * preallocated. */ static inline void -pq_writeint16(StringInfo restrict buf, int16 i) +pq_writeint16(StringInfoData * restrict buf, int16 i) { int16 ni = pg_hton16(i); @@ -72,7 +75,7 @@ pq_writeint16(StringInfo restrict buf, int16 i) * preallocated. */ static inline void -pq_writeint32(StringInfo restrict buf, int32 i) +pq_writeint32(StringInfoData * restrict buf, int32 i) { int32 ni = pg_hton32(i); @@ -86,7 +89,7 @@ pq_writeint32(StringInfo restrict buf, int32 i) * preallocated. */ static inline void -pq_writeint64(StringInfo restrict buf, int64 i) +pq_writeint64(StringInfoData * restrict buf, int64 i) { int64 ni = pg_hton64(i); @@ -106,7 +109,7 @@ pq_writeint64(StringInfo restrict buf, int64 i) * sent to the frontend. */ static inline void -pq_writestring(StringInfo restrict buf, const char *restrict str) +pq_writestring(StringInfoData * restrict buf, const char *restrict str) { int slen = strlen(str); char *p;