Re: RV: [HACKERS] Compilation warning on 9.5

2016-11-08 Thread Robert Haas
On Mon, Nov 7, 2016 at 2:34 PM, Vicky Vergara 
wrote:

> 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
>

Wow, that's pretty ugly.  But it's useful to know that it is available in a
pinch.  Thanks!

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


RV: [HACKERS] Compilation warning on 9.5

2016-11-07 Thread Vicky Vergara



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 
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  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