Compilation warning on 9.5

From: Vicky Vergara <vicky_vergara(at)hotmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Compilation warning on 9.5
Date: 2016-02-12 18:53:11
Message-ID: BAY177-W746905DB451ED4ABE6F248AA90@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello:

I am a pgRouting developer.

In my CmakeLists.txt I use this flags:
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fPIC -O2 -g -Wall -Wconversion -pedantic -fmax-errors=10 -Wmissing-prototypes -frounding-math")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -fPIC -O2 -g -Wconversion -Wall -pedantic -fmax-errors=10 -Wextra -frounding-math -Wno-deprecated")

for testing I use travis CI framework and test pgRouting using postgresql 9.1 to 9.5
I follow the instructions for including:
#include "postgres.h"
#include "executor/spi.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
#if PGSQL_VERSION > 92
#include "access/htup_details.h"
#endif
#include "fmgr.h"

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.
This doesn't happen on postgresql 9.1 to 9.4

for example:

In file included from /usr/include/postgresql/9.5/server/postgres.h:47:0,
from /home/travis/build/pgRouting/pgrouting/src/dijkstra/src/many_to_many_dijkstra.c:31:
/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]

In file included from /usr/include/postgresql/9.5/server/port/atomics.h:119:0,
from /usr/include/postgresql/9.5/server/storage/lwlock.h:19,
from /usr/include/postgresql/9.5/server/storage/lock.h:18,
from /usr/include/postgresql/9.5/server/access/genam.h:20,
from /usr/include/postgresql/9.5/server/nodes/execnodes.h:17,
from /usr/include/postgresql/9.5/server/executor/execdesc.h:18,
from /usr/include/postgresql/9.5/server/utils/portal.h:50,
from /usr/include/postgresql/9.5/server/executor/spi.h:18,
from /home/travis/build/pgRouting/pgrouting/src/dijkstra/src/many_to_many_dijkstra.c:32:
/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]
/usr/include/postgresql/9.5/server/port/atomics/generic.h: In function ‘pg_atomic_sub_fetch_u32_impl’:
/usr/include/postgresql/9.5/server/port/atomics/generic.h:247:2: warning: conversion to ‘uint32’ from ‘int32’ may change the sign of the result [-Wsign-conversion]
/usr/include/postgresql/9.5/server/port/atomics/generic.h: In function ‘pg_atomic_add_fetch_u64_impl’:
/usr/include/postgresql/9.5/server/port/atomics/generic.h:372:2: warning: conversion to ‘long unsigned int’ from ‘int64’ may change the sign of the result [-Wsign-conversion]
/usr/include/postgresql/9.5/server/port/atomics/generic.h: In function ‘pg_atomic_sub_fetch_u64_impl’:
/usr/include/postgresql/9.5/server/port/atomics/generic.h:381:2: warning: conversion to ‘long unsigned int’ from ‘int64’ may change the sign of the result [-Wsign-conversion]
of course, I can't go and modify generic.h, c.h which are included when I include postgres.h or spi.h, or any of the files
that I include that are of the postgresql project.

I already posted in this mailing list http://www.postgresql.org/message-id/BAY177-W104EC0B93C9FC5453B04CD8AA90@phx.gbl
But talking with my co-developer Steve Woodbri, he suggested this mailing list.

you can see a full travis test here:
https://travis-ci.org/pgRouting/pgrouting/builds/108791787
(I have my own warnings which I am fixing and are very visible from 9.1 to 9.4)

Note1: when pgRouting gets released, all those flags:
-Wall -Wconversion -pedantic -fmax-errors=10 -Wmissing-prototypes
will be removed, and of course those warnings won't show up.

Thanks
Vicky Vergara

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-02-12 19:45:23 Re: Compilation warning on 9.5
Previous Message Payal Singh 2016-02-12 18:35:29 Re: ALTER ROLE SET/RESET for multiple options