Opened 7 years ago

Last modified 7 years ago

#3828 closed defect

Warnings during compile on netbsd — at Version 2

Reported by: robe Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.0
Component: postgis Version: 2.3.x
Keywords: Cc:

Description (last modified by robe)

This is from Greg Troxel's packaging observations.

for

PostgreSQL 9.3.18 on x86_64--netbsd, compiled by gcc (nb2 20150115) 4.8.5, 64-bit
  Postgis 2.4.0beta1 - r15614 - 2017-09-02 16:57:24
  scripts 2.4.0beta1 r15614
  GEOS: 3.6.2-CAPI-1.10.2 4d2925d6
  PROJ: Rel. 4.9.3, 15 August 2016

https://lists.osgeo.org/pipermail/postgis-devel/2017-September/026358.html

Two warnings that I don't remember from before and seem not quite right:

build:

gcc -I../../liblwgeom -O2 -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/include/krb5 -fPIC -DPIC -Wall -Wmissing-prototypes -I/usr/pkg/include -I/usr/pkg/include -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/include/krb5 -c -o rt_raster.o rt_raster.c rt_raster.c: In function 'rt_raster_to_gdal_mem': rt_raster.c:1966:4: warning: implicit declaration of function 'strnicmp' [-Wimplicit-function-declaration]

if (strnicmp(pszDataPointer, "0x", 2) == 0)

I think this is #defined to strncasecmp, which needs <strings.h>

check:

(I realize this is some kind poor man's polymorphism, but given that this is C I would expect some kind of inline function (or maybe a macro) to do type-safe casting. I admit to not reading the make check output from earlier versions.)

gcc -O2 -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/include/krb5 -Wall -Wmissing-prototypes -I/usr/pkg/include -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/freetype2 -I/usr/include/krb5 -I.. -c -o cu_algorithm.o cu_algorithm.c cu_algorithm.c: In function 'test_lwpoly_construct_circle': cu_algorithm.c:1118:2: warning: passing argument 1 of 'lwgeom_count_vertices' from incompatible pointer type [enabled by default]

ASSERT_INT_EQUAL(lwgeom_count_vertices(p), segments_per_quad * 4 + 1);

In file included from ../liblwgeom_internal.h:48:0,

from cu_algorithm.c:17:

../liblwgeom.h:1258:12: note: expected 'const struct LWGEOM *' but argument is of type 'struct LWPOLY *'

extern int lwgeom_count_vertices(const LWGEOM *geom);

cu_algorithm.c:1118:2: warning: passing argument 1 of 'lwgeom_count_vertices' from incompatible pointer type [enabled by default]

ASSERT_INT_EQUAL(lwgeom_count_vertices(p), segments_per_quad * 4 + 1);

In file included from ../liblwgeom_internal.h:48:0,

from cu_algorithm.c:17:

../liblwgeom.h:1258:12: note: expected 'const struct LWGEOM *' but argument is of type 'struct LWPOLY *'

extern int lwgeom_count_vertices(const LWGEOM *geom);

cu_algorithm.c:1118:2: warning: passing argument 1 of 'lwgeom_count_vertices' from incompatible pointer type [enabled by default]

ASSERT_INT_EQUAL(lwgeom_count_vertices(p), segments_per_quad * 4 + 1);

In file included from ../liblwgeom_internal.h:48:0,

from cu_algorithm.c:17:

../liblwgeom.h:1258:12: note: expected 'const struct LWGEOM *' but argument is of type 'struct LWPOLY *'

extern int lwgeom_count_vertices(const LWGEOM *geom);

cu_algorithm.c:1121:4: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]

g = lwgeom_get_bbox(lwpoly_as_lwgeom(p));

cu_algorithm.c:1127:2: warning: passing argument 1 of 'lwgeom_area' from incompatible pointer type [enabled by default]

CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(p), M_PI*5*5, 0.1);

In file included from ../liblwgeom_internal.h:48:0,

from cu_algorithm.c:17:

../liblwgeom.h:1180:15: note: expected 'const struct LWGEOM *' but argument is of type 'struct LWPOLY *'

extern double lwgeom_area(const LWGEOM *geom);

Change History (2)

comment:1 by robe, 7 years ago

I'm a bit squeamish about trying to fix this one myself.

comment:2 by robe, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.