Skip to content

Commit 0942141

Browse files
committed
Fix compiler warnings about appendStringInfoVA and appendStringInfoVA_s.
gcc was correctly complaining that these functions should be declared with the `printf` format attribute. Addresses Issue #14.
1 parent 6c8c532 commit 0942141

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

bin/pgut/pgut.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ extern void CHECK_FOR_INTERRUPTS(void);
149149
#define appendStringInfoChar appendPQExpBufferChar
150150
#define appendBinaryStringInfo appendBinaryPQExpBuffer
151151

152-
extern bool appendStringInfoVA(StringInfo str, const char *fmt, va_list args);
152+
extern bool appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
153+
__attribute__((format(printf, 2, 0)));
153154
extern int appendStringInfoFile(StringInfo str, FILE *fp);
154155
extern int appendStringInfoFd(StringInfo str, int fd);
155156

lib/pgut/pgut-spi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
#define EXEC_FAILED(ret, expected) \
1414
(((expected) > 0 && (ret) != (expected)) || (ret) < 0)
1515

16+
static void
17+
appendStringInfoVA_s(StringInfo str, const char *fmt, va_list args)
18+
__attribute__((format(printf, 2, 0)));
19+
1620
static void
1721
termStringInfo(StringInfo str)
1822
{

0 commit comments

Comments
 (0)