Commit c61e871d authored by Darafei Praliaskouski's avatar Darafei Praliaskouski

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




git-svn-id: http://svn.osgeo.org/postgis/trunk@16776 b70326c6-7e19-0410-871a-916f4a2858ee
parent 0ca88f04
Pipeline #30110322 passed with stage
in 23 minutes and 26 seconds
......@@ -2,7 +2,7 @@ env:
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 @@ before_install:
- 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 @@ before_install:
- 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:
......
......@@ -10,7 +10,7 @@
# **********************************************************************
CC=@CC@
CFLAGS=@CFLAGS@ @WARNFLAGS@ @PROJ_CPPFLAGS@
CFLAGS=@WARNFLAGS@ @CFLAGS@ @PROJ_CPPFLAGS@
top_builddir = @top_builddir@
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@
......
......@@ -258,7 +258,7 @@ typedef struct err_param
typedef int NODE ;
typedef int DEFDEF ;
#define MAXTEXT 31
#define MAXTEXT MAXSTRLEN
#define FIRST_LEX_POS 0
#define RIGHT_COMPRESS STOPWORD
......
......@@ -979,8 +979,7 @@ static int phrase_from_morphs( struct morph *morph_vector ,
a ;
BLANK_STRING(Dest) ;
strcpy( Dest ,
morph_vector[ beg ] . Text ) ;
strlcpy(Dest, morph_vector[beg].Text, MAXTEXT);
for ( i = beg + 1 ;
i <= end ;
i++ ) {
......
......@@ -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@
......
......@@ -17,7 +17,7 @@ LIBTOOL = @LIBTOOL@
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)
......
......@@ -77,42 +77,39 @@ lwcollection_build_buffer(const LWCOLLECTION *col, HomogenizeBuffer *buffer)
{
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:
{
/* 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;
}
/* FALLTHROUGH */
default:
case POINTTYPE:
case LINETYPE:
case CIRCSTRINGTYPE:
case COMPOUNDTYPE:
case TRIANGLETYPE:
case CURVEPOLYTYPE:
case POLYGONTYPE:
/* Init if necessary */
if (!buffer->buf[geom->type])
{
lwcollection_build_buffer(lwgeom_as_lwcollection(geom), buffer);
break;
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]++;
break;
default:
lwcollection_build_buffer(lwgeom_as_lwcollection(geom), buffer);
break;
}
}
return;
}
static LWGEOM*
......
......@@ -121,41 +121,31 @@ lwgeom_get_type(const LWGEOM *geom)
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 @@ static inline int
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++)
{
......
......@@ -123,7 +123,7 @@ kmeans(POINT2D** objs, int* clusters, uint32_t n, POINT2D** centers, uint32_t k)
}
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 @@ lwgeom_cluster_2d_kmeans(const LWGEOM** geoms, uint32_t n, uint32_t k)
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++)
{
......
......@@ -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 @@ all: libpgcommon.a
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 @@ check: libpgcommon.a
$(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
......
......@@ -22,7 +22,7 @@ include $(PGXS)
# 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@
......
......@@ -11,7 +11,7 @@
top_builddir = @top_builddir@
CC=@CC@
CFLAGS=@CFLAGS@ @WARNFLAGS@
CFLAGS=@WARNFLAGS@ @CFLAGS@
SHELL = @SHELL@
LIBTOOL = @LIBTOOL@
......@@ -78,7 +78,7 @@ check: cu_tester
endif
# Build the main unit test executable
cu_tester: $(LOADER_OBJS) $(OBJS)
cu_tester: $(LOADER_OBJS) $(OBJS)
$(LIBTOOL) --mode=link \
$(CC) $^ -o $@ $(LIBLWGEOM) $(LDFLAGS)
......
......@@ -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@
......
......@@ -57,7 +57,7 @@ ICONV_LDFLAGS=@ICONV_LDFLAGS@
ICONV_CFLAGS=@ICONV_CFLAGS@
CFLAGS = \
@CFLAGS@ @PICFLAGS@ @WARNFLAGS@ \
@WARNFLAGS@ @CFLAGS@ @PICFLAGS@ \
$(RTCORE_CFLAGS) \
$(LIBLWGEOM_CFLAGS) \
$(PROJ_CFLAGS) \
......
......@@ -28,7 +28,7 @@ LIBGDAL_LDFLAGS = @LIBGDAL_LDFLAGS@
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 = \
......
......@@ -6369,6 +6369,7 @@ Datum RASTER_mapAlgebra2(PG_FUNCTION_ARGS)
switch (extenttype) {
case ET_FIRST:
i = 0;
/* fall through */
case ET_SECOND:
if (i > 1)
i = 1;
......
......@@ -30,7 +30,7 @@ RTCORE_LDFLAGS=$(RT_CORE)/librtcore.a
CC=@CC@
CFLAGS = \
@CFLAGS@ @WARNFLAGS@ \
@WARNFLAGS@ @CFLAGS@ \
$(RTCORE_CFLAGS) \
$(LIBLWGEOM_CFLAGS) \
$(PROJ_CFLAGS) \
......@@ -62,7 +62,7 @@ OBJS= \
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),)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment