From: | Vicky Vergara <vicky_vergara(at)hotmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | RV: Compilation warning on 9.5 |
Date: | 2016-11-07 19:34:41 |
Message-ID: | BN6PR11MB142851C607C9F1053719D7358AA70@BN6PR11MB1428.namprd11.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)sss(dot)pgh(dot)pa(dot)us>
Enviado: viernes, 12 de febrero de 2016 01:45 p. m.
Para: Vicky Vergara
Cc: pgsql-hackers(at)postgresql(dot)org
Asunto: Re: [HACKERS] Compilation warning on 9.5
Vicky Vergara <vicky_vergara(at)hotmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2016-11-07 20:31:25 | Re: Danger of automatic connection reset in psql |
Previous Message | Beena Emerson | 2016-11-07 18:48:14 | Re: Specifying the log file name of pgbench -l option |