Re: pg_upgrade's exec_prog() coding improvement

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_upgrade's exec_prog() coding improvement
Date: 2012-08-24 06:33:51
Message-ID: 5037204F.5030407@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.08.2012 23:07, Alvaro Herrera wrote:
> One problem with this is that I get this warning:
>
> /pgsql/source/HEAD/contrib/pg_upgrade/exec.c: In function ‘s_exec_prog’:
> /pgsql/source/HEAD/contrib/pg_upgrade/exec.c:96:2: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
> /pgsql/source/HEAD/contrib/pg_upgrade/exec.c:96:2: warning: function might be possible candidate for ‘gnu_printf’ format attribute [-Wmissing-format-attribute]
>
> I have no idea how to silence that. Ideas?

You can do what the warning suggests, and tell the compiler that
exec_prog takes printf-like arguments. See elog.h for an example of that:

extern int
errmsg(const char *fmt,...)
/* This extension allows gcc to check the format string for consistency with
the supplied arguments. */
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2012-08-24 07:03:56 Re: 9.2RC1 wraps this Thursday ...
Previous Message Andres Freund 2012-08-24 05:45:59 Re: plperl sigfpe reset can crash the server