From 07013f1d4cb79248638fcd153236d06d2daa7bd4 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 6 Mar 2012 16:39:38 +0200 Subject: [PATCH] Add printf attribute to vararg error functions --- src/plproxy.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plproxy.h b/src/plproxy.h index 4dd582e..72b5ae4 100644 --- a/src/plproxy.h +++ b/src/plproxy.h @@ -75,6 +75,14 @@ #define PG_DETOAST_DATUM_PACKED(x) PG_DETOAST_DATUM(x) #endif +#ifndef PG_PRINTF_ATTRIBUTE +#ifdef WIN32 +#define PG_PRINTF_ATTRIBUTE gnu_printf +#else +#define PG_PRINTF_ATTRIBUTE printf +#endif +#endif + /* * Determine if this argument is to SPLIT */ @@ -336,7 +344,8 @@ typedef struct ProxyFunction /* main.c */ Datum plproxy_call_handler(PG_FUNCTION_ARGS); -void plproxy_error(ProxyFunction *func, const char *fmt,...); +void plproxy_error(ProxyFunction *func, const char *fmt, ...) + __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3))); void plproxy_remote_error(ProxyFunction *func, ProxyConnection *conn, const PGresult *res, bool iserr); /* function.c */ @@ -361,7 +370,8 @@ void plproxy_yylex_startup(void); /* parser.y */ void plproxy_run_parser(ProxyFunction *func, const char *body, int len); -void plproxy_yyerror(const char *fmt,...); +void plproxy_yyerror(const char *fmt, ...) + __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2))); /* type.c */ ProxyComposite *plproxy_composite_info(ProxyFunction *func, TupleDesc tupdesc); -- 2.39.5