Work around overly strict restrict checks by MSVC.
authorAndres Freund
Thu, 12 Oct 2017 00:16:16 +0000 (17:16 -0700)
committerAndres Freund
Thu, 12 Oct 2017 00:23:23 +0000 (17:23 -0700)
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[email protected]

src/include/libpq/pqformat.h

index 9a546b4891585a84b3950336087f8fb76093ccf8..2329669b085c281c138667fc202e8dac52919717 100644 (file)
@@ -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;