From: Paul Ramsey Date: Tue, 12 Nov 2013 22:06:18 +0000 (+0000) Subject: Remove warnings in llvm/clang X-Git-Tag: 2.2.0rc1~1293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1a5f45f2f5c9106139a3af055b2b5d3c09cde3e;p=postgis Remove warnings in llvm/clang git-svn-id: http://svn.osgeo.org/postgis/trunk@12125 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/configure.ac b/configure.ac index 170a8bf32..154295863 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,9 @@ AC_DEFINE([HAVE_VASPRINTF]) AC_CHECK_FUNC(asprintf, [HAVE_ASPRINTF=1], [HAVE_ASPRINTF=0]) AC_DEFINE([HAVE_ASPRINTF]) AC_FUNC_FSEEKO() +AC_CHECK_FUNC(isfinite, [HAVE_ISFINITE=1], [HAVE_ISFINITE=0]) +AC_DEFINE([HAVE_ISFINITE]) + dnl dnl MingW requires use of pwd -W to give proper Windows (not MingW) paths diff --git a/liblwgeom/g_box.c b/liblwgeom/g_box.c index 6fb8b9238..f89f35dd4 100644 --- a/liblwgeom/g_box.c +++ b/liblwgeom/g_box.c @@ -9,6 +9,12 @@ * **********************************************************************/ +#if !HAVE_ISFINITE +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#endif + #include "liblwgeom_internal.h" #include "lwgeom_log.h" #include @@ -146,28 +152,28 @@ int gbox_same(const GBOX *g1, const GBOX *g2) int gbox_is_valid(const GBOX *gbox) { /* X */ - if ( ! finite(gbox->xmin) || isnan(gbox->xmin) || - ! finite(gbox->xmax) || isnan(gbox->xmax) ) + if ( ! isfinite(gbox->xmin) || isnan(gbox->xmin) || + ! isfinite(gbox->xmax) || isnan(gbox->xmax) ) return LW_FALSE; /* Y */ - if ( ! finite(gbox->ymin) || isnan(gbox->ymin) || - ! finite(gbox->ymax) || isnan(gbox->ymax) ) + if ( ! isfinite(gbox->ymin) || isnan(gbox->ymin) || + ! isfinite(gbox->ymax) || isnan(gbox->ymax) ) return LW_FALSE; /* Z */ if ( FLAGS_GET_GEODETIC(gbox->flags) || FLAGS_GET_Z(gbox->flags) ) { - if ( ! finite(gbox->zmin) || isnan(gbox->zmin) || - ! finite(gbox->zmax) || isnan(gbox->zmax) ) + if ( ! isfinite(gbox->zmin) || isnan(gbox->zmin) || + ! isfinite(gbox->zmax) || isnan(gbox->zmax) ) return LW_FALSE; } /* M */ if ( FLAGS_GET_M(gbox->flags) ) { - if ( ! finite(gbox->mmin) || isnan(gbox->mmin) || - ! finite(gbox->mmax) || isnan(gbox->mmax) ) + if ( ! isfinite(gbox->mmin) || isnan(gbox->mmin) || + ! isfinite(gbox->mmax) || isnan(gbox->mmax) ) return LW_FALSE; } diff --git a/liblwgeom/lwcircstring.c b/liblwgeom/lwcircstring.c index f381b3eb2..00dc6cf70 100644 --- a/liblwgeom/lwcircstring.c +++ b/liblwgeom/lwcircstring.c @@ -274,11 +274,10 @@ double lwcircstring_length(const LWCIRCSTRING *circ) double lwcircstring_length_2d(const LWCIRCSTRING *circ) { - double length = 0.0; if ( lwcircstring_is_empty(circ) ) return 0.0; - return ptarray_arc_length_2d(circ->points); + return ptarray_arc_length_2d(circ->points); } /* diff --git a/postgis/gserialized_gist_2d.c b/postgis/gserialized_gist_2d.c index 65dce94e9..345791706 100644 --- a/postgis/gserialized_gist_2d.c +++ b/postgis/gserialized_gist_2d.c @@ -814,8 +814,8 @@ Datum gserialized_gist_compress_2d(PG_FUNCTION_ARGS) POSTGIS_DEBUGF(4, "[GIST] got entry_in->key: %s", box2df_to_string(&bbox_out)); /* Check all the dimensions for finite values */ - if ( ! finite(bbox_out.xmax) || ! finite(bbox_out.xmin) || - ! finite(bbox_out.ymax) || ! finite(bbox_out.ymin) ) + if ( ! isfinite(bbox_out.xmax) || ! isfinite(bbox_out.xmin) || + ! isfinite(bbox_out.ymax) || ! isfinite(bbox_out.ymin) ) { POSTGIS_DEBUG(4, "[GIST] infinite geometry!"); PG_RETURN_POINTER(entry_in); diff --git a/postgis/gserialized_gist_nd.c b/postgis/gserialized_gist_nd.c index d01f04b55..727ed9da6 100644 --- a/postgis/gserialized_gist_nd.c +++ b/postgis/gserialized_gist_nd.c @@ -585,8 +585,8 @@ Datum gserialized_gist_compress(PG_FUNCTION_ARGS) * If not, use the "unknown" GIDX as a key */ for ( i = 0; i < GIDX_NDIMS(bbox_out); i++ ) { - if ( ! finite(GIDX_GET_MAX(bbox_out, i)) - || ! finite(GIDX_GET_MIN(bbox_out, i)) ) + if ( ! isfinite(GIDX_GET_MAX(bbox_out, i)) + || ! isfinite(GIDX_GET_MIN(bbox_out, i)) ) { gidx_set_unknown(bbox_out); gistentryinit(*entry_out, diff --git a/postgis_config.h.in b/postgis_config.h.in index edf1d08d1..094b5304c 100644 --- a/postgis_config.h.in +++ b/postgis_config.h.in @@ -25,6 +25,7 @@ #undef HAVE_VASPRINTF #undef HAVE_ASPRINTF #undef HAVE_FSEEKO +#undef HAVE_ISFINITE /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H