[postgis-tickets] r16776 - Fix Travis GCC warnings
Darafei
komzpa at gmail.com
Thu Sep 13 06:48:42 PDT 2018
Author: komzpa
Date: 2018-09-13 06:48:42 -0700 (Thu, 13 Sep 2018)
New Revision: 16776
Modified:
trunk/.travis.yml
trunk/doc/html/image_src/Makefile.in
trunk/extensions/address_standardizer/pagc_api.h
trunk/extensions/address_standardizer/tokenize.c
trunk/liblwgeom/Makefile.in
trunk/liblwgeom/cunit/Makefile.in
trunk/liblwgeom/lwhomogenize.c
trunk/liblwgeom/lwinline.h
trunk/liblwgeom/lwkmeans.c
trunk/libpgcommon/Makefile.in
trunk/loader/Makefile.in
trunk/loader/cunit/Makefile.in
trunk/raster/Makefile.in
trunk/raster/loader/Makefile.in
trunk/raster/rt_core/Makefile.in
trunk/raster/rt_pg/rtpg_mapalgebra.c
trunk/raster/test/cunit/Makefile.in
Log:
Fix Travis GCC warnings
-Wno-implicit-fallthrough added because of Bison-generated code.
-Wno-unknown-warning-option added because of clang.
-Wno-cast-function-type added because of SFCGAL error printing.
Most other warnings fixed.
Closes https://github.com/postgis/postgis/pull/299
Modified: trunk/.travis.yml
===================================================================
--- trunk/.travis.yml 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/.travis.yml 2018-09-13 13:48:42 UTC (rev 16776)
@@ -2,7 +2,7 @@
matrix:
- CFLAGS="-g -O1" MATRIX_EVAL="touch check-no-trailing-blanks"
- CFLAGS="-g -O2 -fstack-protector -Wformat -Werror=format-security" LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro"
- - CFLAGS="-g -O3 -mtune=generic -fno-omit-frame-pointer -Werror -Wall -Wextra -Wno-unused-parameter"
+ - CFLAGS="-g -O3 -mtune=generic -fno-omit-frame-pointer -Werror -Wall -Wextra -Wno-unused-parameter -Wno-implicit-fallthrough -Wno-unknown-warning-option -Wno-cast-function-type"
- CFLAGS="-g -O0 --coverage -fprofile-arcs -ftest-coverage" LDFLAGS="--coverage -fprofile-arcs -ftest-coverage" CONFIGURE_FLAGS="--enable-debug"
addons:
@@ -17,21 +17,21 @@
- eval "${MATRIX_EVAL}"
- sudo sh -c "echo /usr/lib/x86_64-linux-gnu/libeatmydata.so >> /etc/ld.so.preload"
- sudo service postgresql stop
-
+
- curl -sSfL https://github.com/mapbox/logbt/archive/v2.0.3.tar.gz | sudo tar --gunzip --extract --strip-components=1 --exclude="*md" --exclude="test*" --directory=/usr/local
- curl -sSfL https://raw.githubusercontent.com/mapbox/logbt/30c554dd37b6c96c23fc424f75910fc6d6696f00/bin/logbt | sudo tee /usr/local/bin/logbt > /dev/null
- sudo logbt --setup
-
+
- sudo apt-get remove postgresql-9.4 postgresql-9.5 postgresql-9.6 postgresql-10 postgresql-client-9.4 postgresql-client-9.5 postgresql-client-9.6 postgresql-client-10
- sudo add-apt-repository --yes ppa:ubuntugis/ppa
- sudo add-apt-repository --yes ppa:ubuntugis/ubuntugis-unstable
- - sudo sh -c "echo deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse >> /etc/apt/sources.list"
+ - sudo sh -c "echo deb http://archive.ubuntu.com/ubuntu/ cosmic main restricted universe multiverse >> /etc/apt/sources.list"
- sudo apt-get update -qq
- mkdir -p /home/travis/deb && touch /home/travis/deb/__ && sudo cp -n /home/travis/deb/* /var/cache/apt/archives || true
- - sudo apt-get install -y --allow-unauthenticated --no-install-recommends --no-install-suggests postgresql-11 postgresql-client-11 postgresql-server-dev-11 postgresql-11-dbgsym libproj-dev libprotobuf-c-dev protobuf-c-compiler libc++abi-dev libc++-dev libgcc1-dbg libsfcgal1 libsfcgal-dev libxml2-utils libcunit1-dev xsltproc docbook-xsl docbook-mathml dblatex libgeos-dev libjson-c-dev libprotobuf-c0-dev libgdal-dev gdb libc6-dbg gcc
-
+ - sudo apt-get install -y --allow-unauthenticated --no-install-recommends --no-install-suggests postgresql-11 postgresql-client-11 postgresql-server-dev-11 postgresql-11-dbgsym libproj-dev libprotobuf-c-dev protobuf-c-compiler libc++abi-dev libc++-dev libgcc1-dbg libsfcgal1 libsfcgal-dev libxml2-utils libcunit1-dev xsltproc docbook-xsl docbook-mathml dblatex libgeos-dev libjson-c-dev libgdal-dev gdb libc6-dbg gcc
+
- cp -n /var/cache/apt/archives/* /home/travis/deb || true
-
+
- echo "postgres soft core unlimited" | sudo tee -a /etc/security/limits.conf
- echo "postgres hard core unlimited" | sudo tee -a /etc/security/limits.conf
- echo "pg_ctl_options = '-c'" | sudo tee /etc/postgresql/11/main/pg_ctl.conf
@@ -40,9 +40,9 @@
- sudo usermod -u 1000 postgres
- sudo adduser travis ssl-cert
- sudo service postgresql start
- - sudo service postgresql status
+ - sudo service postgresql status
- sudo -u postgres createuser --superuser travis
-
+
- sudo ldconfig
after_failure:
Modified: trunk/doc/html/image_src/Makefile.in
===================================================================
--- trunk/doc/html/image_src/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/doc/html/image_src/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -10,7 +10,7 @@
# **********************************************************************
CC=@CC@
-CFLAGS=@CFLAGS@ @WARNFLAGS@ @PROJ_CPPFLAGS@
+CFLAGS=@WARNFLAGS@ @CFLAGS@ @PROJ_CPPFLAGS@
top_builddir = @top_builddir@
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@
Modified: trunk/extensions/address_standardizer/pagc_api.h
===================================================================
--- trunk/extensions/address_standardizer/pagc_api.h 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/extensions/address_standardizer/pagc_api.h 2018-09-13 13:48:42 UTC (rev 16776)
@@ -258,7 +258,7 @@
typedef int NODE ;
typedef int DEFDEF ;
-#define MAXTEXT 31
+#define MAXTEXT MAXSTRLEN
#define FIRST_LEX_POS 0
#define RIGHT_COMPRESS STOPWORD
Modified: trunk/extensions/address_standardizer/tokenize.c
===================================================================
--- trunk/extensions/address_standardizer/tokenize.c 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/extensions/address_standardizer/tokenize.c 2018-09-13 13:48:42 UTC (rev 16776)
@@ -979,8 +979,7 @@
a ;
BLANK_STRING(Dest) ;
- strcpy( Dest ,
- morph_vector[ beg ] . Text ) ;
+ strlcpy(Dest, morph_vector[beg].Text, MAXTEXT);
for ( i = beg + 1 ;
i <= end ;
i++ ) {
Modified: trunk/liblwgeom/Makefile.in
===================================================================
--- trunk/liblwgeom/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/liblwgeom/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -24,7 +24,7 @@
CC = @CC@
CPPFLAGS = @CPPFLAGS@
-CFLAGS = @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ @JSON_CPPFLAGS@
+CFLAGS = @WARNFLAGS@ @CFLAGS@ @PICFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ @JSON_CPPFLAGS@
LDFLAGS = @LDFLAGS@ @GEOS_LDFLAGS@ -lgeos_c @PROJ_LDFLAGS@ -lproj @JSON_LDFLAGS@ -lm
NUMERICFLAGS = @NUMERICFLAGS@
top_builddir = @top_builddir@
Modified: trunk/liblwgeom/cunit/Makefile.in
===================================================================
--- trunk/liblwgeom/cunit/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/liblwgeom/cunit/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -17,7 +17,7 @@
CUNIT_LDFLAGS=@CUNIT_LDFLAGS@
CUNIT_CPPFLAGS=@CUNIT_CPPFLAGS@ -I..
-CFLAGS=@CFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ $(CUNIT_CPPFLAGS)
+CFLAGS=@WARNFLAGS@ @CFLAGS@ @GEOS_CPPFLAGS@ @PROJ_CPPFLAGS@ $(CUNIT_CPPFLAGS)
LDFLAGS = @GEOS_LDFLAGS@ -lgeos_c $(CUNIT_LDFLAGS) -lm
# ADD YOUR NEW TEST FILE HERE (1/1)
Modified: trunk/liblwgeom/lwhomogenize.c
===================================================================
--- trunk/liblwgeom/lwhomogenize.c 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/liblwgeom/lwhomogenize.c 2018-09-13 13:48:42 UTC (rev 16776)
@@ -77,42 +77,39 @@
{
uint32_t i;
- if ( ! col ) return;
- if ( lwgeom_is_empty(lwcollection_as_lwgeom(col)) ) return;
- for ( i = 0; i < col->ngeoms; i++ )
+ if (!col || lwcollection_is_empty(col))
+ return;
+
+ for (i = 0; i < col->ngeoms; i++)
{
LWGEOM *geom = col->geoms[i];
- switch(geom->type)
+ switch (geom->type)
{
- case POINTTYPE:
- case LINETYPE:
- case CIRCSTRINGTYPE:
- case COMPOUNDTYPE:
- case TRIANGLETYPE:
- case CURVEPOLYTYPE:
- case POLYGONTYPE:
+ case POINTTYPE:
+ case LINETYPE:
+ case CIRCSTRINGTYPE:
+ case COMPOUNDTYPE:
+ case TRIANGLETYPE:
+ case CURVEPOLYTYPE:
+ case POLYGONTYPE:
+ /* Init if necessary */
+ if (!buffer->buf[geom->type])
{
- /* Init if necessary */
- if ( ! buffer->buf[geom->type] )
- {
- LWCOLLECTION *bufcol = lwcollection_construct_empty(COLLECTIONTYPE, col->srid, FLAGS_GET_Z(col->flags), FLAGS_GET_M(col->flags));
- bufcol->type = lwtype_get_collectiontype(geom->type);
- buffer->buf[geom->type] = bufcol;
- }
- /* Add sub-geom to buffer */
- lwcollection_add_lwgeom(buffer->buf[geom->type], lwgeom_clone(geom));
- /* Increment count for this singleton type */
- buffer->cnt[geom->type] = buffer->cnt[geom->type] + 1;
+ LWCOLLECTION *bufcol = lwcollection_construct_empty(
+ COLLECTIONTYPE, col->srid, FLAGS_GET_Z(col->flags), FLAGS_GET_M(col->flags));
+ bufcol->type = lwtype_get_collectiontype(geom->type);
+ buffer->buf[geom->type] = bufcol;
}
- /* FALLTHROUGH */
- default:
- {
- lwcollection_build_buffer(lwgeom_as_lwcollection(geom), buffer);
- break;
- }
+ /* Add sub-geom to buffer */
+ lwcollection_add_lwgeom(buffer->buf[geom->type], lwgeom_clone(geom));
+ /* Increment count for this singleton type */
+ buffer->cnt[geom->type]++;
+ break;
+ default:
+ lwcollection_build_buffer(lwgeom_as_lwcollection(geom), buffer);
+ break;
}
}
- return;
}
static LWGEOM*
Modified: trunk/liblwgeom/lwinline.h
===================================================================
--- trunk/liblwgeom/lwinline.h 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/liblwgeom/lwinline.h 2018-09-13 13:48:42 UTC (rev 16776)
@@ -121,41 +121,31 @@
static inline int
lwpoint_is_empty(const LWPOINT *point)
{
- if (!point->point || point->point->npoints < 1)
- return LW_TRUE;
- return LW_FALSE;
+ return !point->point || point->point->npoints < 1;
}
static inline int
lwline_is_empty(const LWLINE *line)
{
- if (!line->points || line->points->npoints < 1)
- return LW_TRUE;
- return LW_FALSE;
+ return !line->points || line->points->npoints < 1;
}
static inline int
lwcircstring_is_empty(const LWCIRCSTRING *circ)
{
- if (!circ->points || circ->points->npoints < 1)
- return LW_TRUE;
- return LW_FALSE;
+ return !circ->points || circ->points->npoints < 1;
}
static inline int
lwpoly_is_empty(const LWPOLY *poly)
{
- if ((poly->nrings < 1) || (!poly->rings) || (!poly->rings[0]) || (poly->rings[0]->npoints < 1))
- return LW_TRUE;
- return LW_FALSE;
+ return poly->nrings < 1 || !poly->rings || !poly->rings[0] || poly->rings[0]->npoints < 1;
}
static inline int
lwtriangle_is_empty(const LWTRIANGLE *triangle)
{
- if (!triangle->points || triangle->points->npoints < 1)
- return LW_TRUE;
- return LW_FALSE;
+ return !triangle->points || triangle->points->npoints < 1;
}
static inline int lwgeom_is_empty(const LWGEOM *geom);
@@ -164,7 +154,7 @@
lwcollection_is_empty(const LWCOLLECTION *col)
{
uint32_t i;
- if ((col->ngeoms == 0) || (!col->geoms))
+ if (col->ngeoms == 0 || !col->geoms)
return LW_TRUE;
for (i = 0; i < col->ngeoms; i++)
{
Modified: trunk/liblwgeom/lwkmeans.c
===================================================================
--- trunk/liblwgeom/lwkmeans.c 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/liblwgeom/lwkmeans.c 2018-09-13 13:48:42 UTC (rev 16776)
@@ -123,7 +123,7 @@
}
static void
-kmeans_init(POINT2D** objs, int* clusters, uint32_t n, POINT2D** centers, POINT2D* centers_raw, uint32_t k)
+kmeans_init(POINT2D **objs, uint32_t n, POINT2D **centers, POINT2D *centers_raw, uint32_t k)
{
double* distances;
uint32_t p1 = 0, p2 = 0;
@@ -327,12 +327,12 @@
if (k > 1)
{
- kmeans_init(objs, clusters, n, centers, centers_raw, k);
+ kmeans_init(objs, n, centers, centers_raw, k);
result = kmeans(objs, clusters, n, centers, k);
}
else
{
- /* k=0: everythong is unclusterable
+ /* k=0: everything is unclusterable
* k=1: mark up NULL and non-NULL */
for (i = 0; i < n; i++)
{
Modified: trunk/libpgcommon/Makefile.in
===================================================================
--- trunk/libpgcommon/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/libpgcommon/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -10,7 +10,7 @@
# **********************************************************************
CC=@CC@
-CFLAGS=-I../liblwgeom @CFLAGS@ @PGSQL_BE_CPPFLAGS@ @PROJ_CPPFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GETTEXT_CFLAGS@
+CFLAGS=-I../liblwgeom @WARNFLAGS@ @CFLAGS@ @PGSQL_BE_CPPFLAGS@ @PROJ_CPPFLAGS@ @PICFLAGS@ @GETTEXT_CFLAGS@
LDFLAGS=@GETTEXT_LDFLAGS@ @LIBINTL@
NUMERICFLAGS=@NUMERICFLAGS@
@@ -39,15 +39,15 @@
install uninstall:
libpgcommon.a: $(SA_OBJS) $(SA_HEADERS)
- ar rs libpgcommon.a $(SA_OBJS)
+ ar rs libpgcommon.a $(SA_OBJS)
maintainer-clean: clean
-clean:
+clean:
$(MAKE) -C cunit clean
- rm -f $(SA_OBJS)
- rm -f $(NM_OBJS)
- rm -f libpgcommon.a
+ rm -f $(SA_OBJS)
+ rm -f $(NM_OBJS)
+ rm -f libpgcommon.a
distclean: clean
$(MAKE) -C cunit distclean
@@ -57,7 +57,7 @@
$(MAKE) -C cunit check
# Command to build each of the .o files
-$(SA_OBJS): %.o: %.c
+$(SA_OBJS): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(SA_OBJS): ../postgis_config.h
Modified: trunk/loader/Makefile.in
===================================================================
--- trunk/loader/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/loader/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -22,7 +22,7 @@
# Set CFLAGS afer PGXS, otherwise it will get overwritten with the PGXS
# version which is not what we want.
CC=@CC@
-CFLAGS=-I ../liblwgeom @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @PROJ_CPPFLAGS@
+CFLAGS=-I ../liblwgeom @WARNFLAGS@ @CFLAGS@ @PICFLAGS@ @PROJ_CPPFLAGS@
top_builddir = @top_builddir@
SHELL = @SHELL@
INSTALL = @INSTALL@
Modified: trunk/loader/cunit/Makefile.in
===================================================================
--- trunk/loader/cunit/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/loader/cunit/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -11,7 +11,7 @@
top_builddir = @top_builddir@
CC=@CC@
-CFLAGS=@CFLAGS@ @WARNFLAGS@
+CFLAGS=@WARNFLAGS@ @CFLAGS@
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@
@@ -78,7 +78,7 @@
endif
# Build the main unit test executable
-cu_tester: $(LOADER_OBJS) $(OBJS)
+cu_tester: $(LOADER_OBJS) $(OBJS)
$(LIBTOOL) --mode=link \
$(CC) $^ -o $@ $(LIBLWGEOM) $(LDFLAGS)
Modified: trunk/raster/Makefile.in
===================================================================
--- trunk/raster/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/raster/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -20,7 +20,7 @@
#############################################################################
CC=@CC@
-CFLAGS=-I../liblwgeom @CFLAGS@ @WARNFLAGS@
+CFLAGS=-I../liblwgeom @WARNFLAGS@ @CFLAGS@
LDFLAGS = @LDFLAGS@
all: @RT_CORE_LIB@ @RT_PG_LIB@ @RT_LOADER@ @RT_POSTGIS_SQL@
Modified: trunk/raster/loader/Makefile.in
===================================================================
--- trunk/raster/loader/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/raster/loader/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -57,7 +57,7 @@
ICONV_CFLAGS=@ICONV_CFLAGS@
CFLAGS = \
- @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ \
+ @WARNFLAGS@ @CFLAGS@ @PICFLAGS@ \
$(RTCORE_CFLAGS) \
$(LIBLWGEOM_CFLAGS) \
$(PROJ_CFLAGS) \
Modified: trunk/raster/rt_core/Makefile.in
===================================================================
--- trunk/raster/rt_core/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/raster/rt_core/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -28,7 +28,7 @@
GEOS_LDFLAGS = @GEOS_LDFLAGS@ -lgeos_c
PROJ_LDFLAGS = @PROJ_LDFLAGS@ -lproj
LDFLAGS = $(LIBLWGEOM_LDFLAGS) $(LIBGDAL_LDFLAGS) $(PROJ_LDFLAGS) $(GEOS_LDFLAGS)
-CFLAGS = $(LIBLWGEOM_CFLAGS) @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ $(LIBGDAL_CFLAGS) @PROJ_CPPFLAGS@ @GEOS_CPPFLAGS@
+CFLAGS = $(LIBLWGEOM_CFLAGS) @WARNFLAGS@ @CFLAGS@ @PICFLAGS@ $(LIBGDAL_CFLAGS) @PROJ_CPPFLAGS@ @GEOS_CPPFLAGS@
# Standalone RTCORE objects
RT_OBJS = \
Modified: trunk/raster/rt_pg/rtpg_mapalgebra.c
===================================================================
--- trunk/raster/rt_pg/rtpg_mapalgebra.c 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/raster/rt_pg/rtpg_mapalgebra.c 2018-09-13 13:48:42 UTC (rev 16776)
@@ -6369,6 +6369,7 @@
switch (extenttype) {
case ET_FIRST:
i = 0;
+ /* fall through */
case ET_SECOND:
if (i > 1)
i = 1;
Modified: trunk/raster/test/cunit/Makefile.in
===================================================================
--- trunk/raster/test/cunit/Makefile.in 2018-09-13 13:35:33 UTC (rev 16775)
+++ trunk/raster/test/cunit/Makefile.in 2018-09-13 13:48:42 UTC (rev 16776)
@@ -30,7 +30,7 @@
CC=@CC@
CFLAGS = \
- @CFLAGS@ @WARNFLAGS@ \
+ @WARNFLAGS@ @CFLAGS@ \
$(RTCORE_CFLAGS) \
$(LIBLWGEOM_CFLAGS) \
$(PROJ_CFLAGS) \
@@ -62,7 +62,7 @@
cu_spatial_relationship.o \
cu_mapalgebra.o \
cu_misc.o \
- cu_tester.o
+ cu_tester.o
# If we couldn't find the cunit library then display a helpful message
ifeq ($(CUNIT_LDFLAGS),)
More information about the postgis-tickets
mailing list