Opened 8 years ago

Closed 8 years ago

#3696 closed defect (fixed)

Topology compiler warnings

Reported by: dbaston Owned by: strk
Priority: medium Milestone: PostGIS 2.4.0
Component: postgis Version: master
Keywords: Cc:

Description

Seen with gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

postgis_topology.c: In function 'cb_insertNodes':
postgis_topology.c:1439:26: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint64 {aka long unsigned int}' [-Wformat=]
   cberror(topo->be_data, "processed %u rows, expected %d",
                          ^
postgis_topology.c: In function 'cb_insertEdges':
postgis_topology.c:1496:26: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint64 {aka long unsigned int}' [-Wformat=]
   cberror(topo->be_data, "processed %u rows, expected %d",
                          ^
postgis_topology.c: In function 'cb_insertFaces':
postgis_topology.c:1554:26: warning: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'uint64 {aka long unsigned int}' [-Wformat=]
   cberror(topo->be_data, "processed %u rows, expected %d",
                          ^
postgis_topology.c: In function 'cb_getNextEdgeId':
postgis_topology.c:1920:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint64 {aka long unsigned int}' [-Wformat=]
   cberror(topo->be_data, "processed %d rows, expected 1", SPI_processed);
                          ^

Change History (4)

comment:1 by strk, 8 years ago

Ouch, this seems to be dependent upon system or PostgreSQL version, see https://lists.osgeo.org/pipermail//postgis-tickets/2016-June/010372.html

There should be a macro defined in PostgreSQL headers to do that properly

comment:2 by strk, 8 years ago

I've been told (from #postgresql IRC channel on Freenode, by ilmari and johto) that it is 32-bit before 9.6 and 64-bit from 9.6 up. So we need to switch based on version OR (which would probably be easy) upcast to 64bit. Unsigned in both cases.

comment:3 by strk, 8 years ago

Owner: changed from pramsey to strk
Status: newassigned

comment:4 by strk, 8 years ago

Resolution: fixed
Status: assignedclosed

In 15292:

Fix build warnings in PostgreSQL-9.6 based builds

Closes #3696

NOTE: SPI_processed datatype changed from 32 to 64 bit stsarting

with PostgreSQL 9.6

Note: See TracTickets for help on using tickets.