RV: Compilation warning on 9.5

Поиск
Список
Период
Сортировка
От Vicky Vergara
Тема RV: Compilation warning on 9.5
Дата
Msg-id BN6PR11MB142851C607C9F1053719D7358AA70@BN6PR11MB1428.namprd11.prod.outlook.com
обсуждение исходный текст
Ответ на Compilation warning on 9.5  (Vicky Vergara <vicky_vergara@hotmail.com>)
Ответы Re: RV: Compilation warning on 9.5
Список pgsql-hackers


 

Hello,

Posting an update to this issue (which by the way also shows up on 9.6)

Maybe this information is useful for extension developers (that have all the warnings flags on while developing using GNUC)


By wrapping the files as follows, any warnings generated by the postgres's header files are ignored.


#ifdef __GNUC__
#pragma GCC diagnostic ignored "-pedantic"
#endif

#include "postgres.h"

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif


#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

#include "executor/spi.h"

#ifdef __GNUC__
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
#endif

#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif

#include "funcapi.h"

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

Vicky




De: Tom Lane <tgl@sss.pgh.pa.us>
Enviado: viernes, 12 de febrero de 2016 01:45 p. m.
Para: Vicky Vergara
Cc: pgsql-hackers@postgresql.org
Asunto: Re: [HACKERS] Compilation warning on 9.5
 
Vicky Vergara <vicky_vergara@hotmail.com> writes:
> I wonder if -std=gnu99 is the correct standard to include postgres.h etc. in 9.5
> because that standard (and all the flags I am using to generate pgrouting code without warnings)
> catches the following catches warnings of type conversions on some postgresql included files.

It's not -std=gnu99 that's causing those messages, it's -pedantic and
-Wconversion respectively.

> /usr/include/postgresql/9.5/server/c.h:298:9: warning: ISO C does not support ‘__int128’ type [-pedantic]
> /usr/include/postgresql/9.5/server/c.h:299:18: warning: ISO C does not support ‘__int128’ type [-pedantic]

We're not going to do anything about this one; certainly we won't stop
using int128 where it's available, and there isn't any other apparent way
to suppress the warning.  I doubt that -pedantic is a useful switch in
practice, and this seems to be a particularly unhelpful bit of pedantry.
Consider dropping that flag.

> /usr/include/postgresql/9.5/server/port/atomics/generic.h: In function ‘pg_atomic_add_fetch_u32_impl’:
> /usr/include/postgresql/9.5/server/port/atomics/generic.h:238:2: warning: conversion to ‘uint32’ from ‘int32’ may change the sign of the result [-Wsign-conversion]

According to the gcc manual, inserting explicit casts would silence these;
is that worth doing?  I doubt anyone cares about making all our code
-Wconversion clean, but maybe making the headers clean would be worth
the trouble.

                        regards, tom lane

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

Предыдущее
От: Beena Emerson
Дата:
Сообщение: Re: Specifying the log file name of pgbench -l option
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Danger of automatic connection reset in psql