Re: pg_upgrade's exec_prog() coding improvement

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: pg_upgrade's exec_prog() coding improvement
Дата
Msg-id 20120824143045.GA23571@momjian.us
обсуждение исходный текст
Ответ на Re: pg_upgrade's exec_prog() coding improvement  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pg_upgrade's exec_prog() coding improvement
Список pgsql-hackers
On Fri, Aug 24, 2012 at 10:08:58AM -0400, Tom Lane wrote:
> Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> > 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’
formatattribute [-Wmissing-format-attribute]
 
> >> /pgsql/source/HEAD/contrib/pg_upgrade/exec.c:96:2: warning: function might be possible candidate for ‘gnu_printf’
formatattribute [-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.
> 
> exec_prog already has such decoration, and Alvaro's patch doesn't remove
> it.  So the question is, exactly what the heck does that warning mean?

It sounds like it is suggestioning to use more specific attribute
decoration.  This might be relevant:
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html-Wmissing-format-attribute    Warn about function pointers that
mightbe candidates for formatattributes. Note these are only possible candidates, not absolute ones.GCC guesses that
functionpointers with format attributes that are usedin assignment, initialization, parameter passing or return
statementsshouldhave a corresponding format attribute in the resulting type. I.e.the left-hand side of the assignment
orinitialization, the type of theparameter variable, or the return type of the containing functionrespectively should
alsohave a format attribute to avoid the warning.    GCC also warns about function definitions that might be
candidatesforformat attributes. Again, these are only possible candidates. GCCguesses that format attributes might be
appropriatefor any functionthat calls a function like vprintf or vscanf, but this might not alwaysbe the case, and some
functionsfor which format attributes areappropriate may not be detected. 
 

and I see this option enabled in configure.in.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 9.2RC1 wraps this Thursday ...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: plperl sigfpe reset can crash the server