Skip to content

Commit 060b069

Browse files
committed
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
1 parent 4c119fb commit 060b069

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/include/libpq/pqformat.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ extern void pq_sendfloat8(StringInfo buf, float8 f);
4242
* assumption that buf, buf->len, buf->data and *buf->data don't
4343
* overlap. Without the annotation buf->len etc cannot be kept in a register
4444
* over subsequent pq_writeint* calls.
45+
*
46+
* The use of StringInfoData * rather than StringInfo is due to MSVC being
47+
* overly picky and demanding a * before a restrict.
4548
*/
4649
static inline void
47-
pq_writeint8(StringInfo restrict buf, int8 i)
50+
pq_writeint8(StringInfoData * restrict buf, int8 i)
4851
{
4952
int8 ni = i;
5053

@@ -58,7 +61,7 @@ pq_writeint8(StringInfo restrict buf, int8 i)
5861
* preallocated.
5962
*/
6063
static inline void
61-
pq_writeint16(StringInfo restrict buf, int16 i)
64+
pq_writeint16(StringInfoData * restrict buf, int16 i)
6265
{
6366
int16 ni = pg_hton16(i);
6467

@@ -72,7 +75,7 @@ pq_writeint16(StringInfo restrict buf, int16 i)
7275
* preallocated.
7376
*/
7477
static inline void
75-
pq_writeint32(StringInfo restrict buf, int32 i)
78+
pq_writeint32(StringInfoData * restrict buf, int32 i)
7679
{
7780
int32 ni = pg_hton32(i);
7881

@@ -86,7 +89,7 @@ pq_writeint32(StringInfo restrict buf, int32 i)
8689
* preallocated.
8790
*/
8891
static inline void
89-
pq_writeint64(StringInfo restrict buf, int64 i)
92+
pq_writeint64(StringInfoData * restrict buf, int64 i)
9093
{
9194
int64 ni = pg_hton64(i);
9295

@@ -106,7 +109,7 @@ pq_writeint64(StringInfo restrict buf, int64 i)
106109
* sent to the frontend.
107110
*/
108111
static inline void
109-
pq_writestring(StringInfo restrict buf, const char *restrict str)
112+
pq_writestring(StringInfoData * restrict buf, const char *restrict str)
110113
{
111114
int slen = strlen(str);
112115
char *p;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy