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
This commit is contained in:
Andres Freund 2017-10-11 17:16:16 -07:00
parent 4c119fbcd4
commit 060b069984

View 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 * 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 * overlap. Without the annotation buf->len etc cannot be kept in a register
* over subsequent pq_writeint* calls. * 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 static inline void
pq_writeint8(StringInfo restrict buf, int8 i) pq_writeint8(StringInfoData * restrict buf, int8 i)
{ {
int8 ni = i; int8 ni = i;
@ -58,7 +61,7 @@ pq_writeint8(StringInfo restrict buf, int8 i)
* preallocated. * preallocated.
*/ */
static inline void static inline void
pq_writeint16(StringInfo restrict buf, int16 i) pq_writeint16(StringInfoData * restrict buf, int16 i)
{ {
int16 ni = pg_hton16(i); int16 ni = pg_hton16(i);
@ -72,7 +75,7 @@ pq_writeint16(StringInfo restrict buf, int16 i)
* preallocated. * preallocated.
*/ */
static inline void static inline void
pq_writeint32(StringInfo restrict buf, int32 i) pq_writeint32(StringInfoData * restrict buf, int32 i)
{ {
int32 ni = pg_hton32(i); int32 ni = pg_hton32(i);
@ -86,7 +89,7 @@ pq_writeint32(StringInfo restrict buf, int32 i)
* preallocated. * preallocated.
*/ */
static inline void static inline void
pq_writeint64(StringInfo restrict buf, int64 i) pq_writeint64(StringInfoData * restrict buf, int64 i)
{ {
int64 ni = pg_hton64(i); int64 ni = pg_hton64(i);
@ -106,7 +109,7 @@ pq_writeint64(StringInfo restrict buf, int64 i)
* sent to the frontend. * sent to the frontend.
*/ */
static inline void 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); int slen = strlen(str);
char *p; char *p;