]> granicus.if.org Git - postgis/commitdiff
Fix Travis GCC warnings
authorDarafei Praliaskouski <me@komzpa.net>
Thu, 13 Sep 2018 13:48:42 +0000 (13:48 +0000)
committerDarafei Praliaskouski <me@komzpa.net>
Thu, 13 Sep 2018 13:48:42 +0000 (13:48 +0000)
-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

17 files changed:
.travis.yml
doc/html/image_src/Makefile.in
extensions/address_standardizer/pagc_api.h
extensions/address_standardizer/tokenize.c
liblwgeom/Makefile.in
liblwgeom/cunit/Makefile.in
liblwgeom/lwhomogenize.c
liblwgeom/lwinline.h
liblwgeom/lwkmeans.c
libpgcommon/Makefile.in
loader/Makefile.in
loader/cunit/Makefile.in
raster/Makefile.in
raster/loader/Makefile.in
raster/rt_core/Makefile.in
raster/rt_pg/rtpg_mapalgebra.c
raster/test/cunit/Makefile.in

index e313557e1c080878d51fb7626a30406a4fa4578f..436f00f60e39be1c0be682bea4e4973eb3aafbbc 100644 (file)
@@ -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:
index fa7fb090d2e70bb9e52a55b811a7ea8a56dbf934..88e0432bfc48c4ae5d1ccc4c8e54b756b7044fd4 100644 (file)
@@ -10,7 +10,7 @@
 # **********************************************************************
 
 CC=@CC@
-CFLAGS=@CFLAGS@ @WARNFLAGS@ @PROJ_CPPFLAGS@
+CFLAGS=@WARNFLAGS@ @CFLAGS@ @PROJ_CPPFLAGS@
 top_builddir = @top_builddir@
 SHELL = @SHELL@
 LIBTOOL = @LIBTOOL@
index 18e4ab3d40b72850a3280547647369d489162513..b84821136376a90cc9dc0ce202290f9f4de43749 100644 (file)
@@ -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
index ef5eb2940b8a558a64647d0409062bc04274ead2..1dd9554c4e7307e9afff3e972f2015e206e932bc 100644 (file)
@@ -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++ ) {
index 265302c2ce17b675b5fc260b276749a52f35571d..696b435628820dbf870dc41c12ab94088ab40690 100644 (file)
@@ -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@
index 4538d7d446161d3b5f27671e53c859d5e03dc4d4..0a3c06513d2e64fe3b2780450cf23442deb5ddb4 100644 (file)
@@ -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)
index 047b1e7491bcf8209e4ce6e76fd518584e108339..8bc9faf827565ec2949f859fd2b2a9e735fb74e8 100644 (file)
@@ -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*
index 0f3869c38c8cda535a525c831a7b01f1323dbd98..d97a6e94caba543ceb1636a63a8cbbc3ea212f13 100644 (file)
@@ -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++)
        {
index 747385bd38d4a07f80bb9dd7451a2924529f20f8..360983daf95d2ef62f32d573cd65ba032351deaa 100644 (file)
@@ -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++)
                {
index da368cc85380b0fdccced14c4cd276b98c180add..3252c301b511fe35e7a3059e1e12cd2e874513e3 100644 (file)
@@ -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
index 830db51c8fd14999e1599165f5d8d38cecc5e812..6954a6cd4a4047cca4f23cc4a672b37e3e37d372 100644 (file)
@@ -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@
index 8bc51fee2750a7288c36e6fc3a58e9549082065e..2c8401dd7941fe46b906cee0795f6380b73081a2 100644 (file)
@@ -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)
 
index fa6e1048b4e5d3dcc1605e679cfa38260441df3c..d37d7873602ac163ba1d9dd48dab07376c88e67f 100644 (file)
@@ -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@
index f7353dbe664cf7b6133f4861723823bed484e888..e59e73be259f7f72a7fc8c16b933b3ee33b58607 100644 (file)
@@ -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) \
index d5a8f5d58bb545db7803811796e81ec64588278d..1ec49cd18f9beba192c8d3258d5bfae296216df0 100644 (file)
@@ -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 = \
index 9793bfe4797412d9927dadf256efa2ff0d635ec3..01eb2a373350556527db4fc5196e7229901a8061 100644 (file)
@@ -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;
index 4124c630c44a40730c309d3f8856d1b7c38f6268..37f13d358602461395aa12a24f6bf5beaf094c3f 100644 (file)
@@ -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),)