[gdal-dev] results from building with -Werror on NetBSD

Even Rouault even.rouault at spatialys.com
Sun Nov 1 08:50:08 PST 2015


Le dimanche 01 novembre 2015 17:29:02, Greg Troxel a écrit :
> (I just checked out svn trunk and have built on NetBSD 6 i386, with only
> a few small issues.   I'm not entirely clear on whether I should be
> filing bugs as some of the issues are a bit confusing.  I'm sending
> separate mails as the issues are unrelated.   The good news is that I
> didn't find any format-string warnings about types.)
> 
> The first issue is that in cpl_conv.cc, I got an error about atoll not
> being defined.  This surprised me, because stdlib.h was included.
> However there are a lot of namespacing includes in there; atoll is from
> C99.  A simple test program builds fine.
> 
> Building gdal results in a complain that atoll was not declared (log at
> end).
> 
> The following patch resolves the issue.  I don't understand the strategy
> for turning on/off the namespacing defines, but clearly something is
> going on because I normally don't see _XOPEN_SOURCE defined.
> 
> Index: port/cpl_conv.cpp
> ===================================================================
> --- port/cpl_conv.cpp	(revision 31282)
> +++ port/cpl_conv.cpp	(working copy)
> @@ -31,6 +31,9 @@
>  // For uselocale
>  #define _XOPEN_SOURCE 700
> 
> +// For atoll
> +#define _ISOC99_SOURCE
> +
>  #ifdef MSVC_USE_VLD
>  #include <vld.h>
>  #endif

Applied in r31284. Thanks. For other fixes, you might want to create a ticket 
in Trac with one or several patches.

> 
> 
> ----------------------------------------
> [The following test program compiles warning-free with -Wall with both
> gcc and clang, with as gcc main.c or g++ main.cc]
> 
> #include <stdlib.h>
> 
> int main()
> {
>   long long i;
> 
>   i = atoll("1234");
> 
>   return 0;
> }
> ----------------------------------------
> [log from gdal without my change]
> 
> gmake[1]: Entering directory '/usr/home/gdt/SOFTWARE/GEO/gdal/port'
> /bin/ksh /home/gdt/SOFTWARE/GEO/gdal/libtool --mode=compile --tag=CXX g++
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/home/gdt/SOFTWARE/GEO/gdal/gcore
> -I/home/gdt/SOFTWARE/GEO/gdal/alg -I/home/gdt/SOFTWARE/GEO/gdal/ogr
> -I/home/gdt/SOFTWARE/GEO/gdal/ogr/ogrsf_frmts
> -I/home/gdt/SOFTWARE/GEO/gdal/gnm -I/home/gdt/SOFTWARE/GEO/gdal/apps -g
> -O2  -Wall -Wextra -Winit-self -Wunused-parameter -Wformat
> -Werror=format-security -Wno-format-nonliteral -Werror=vla -Wno-clobbered
> -Wmissing-declarations  -DOGR_ENABLED -I/usr/pkg/include
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/usr/pkg/include 
> -DGDAL_COMPILATION	-I/usr/pkg/include  -DHAVE_CURL -DHAVE_LIBZ
> -I/usr/pkg/include/libxml2 -DHAVE_LIBXML2 -DUSE_ONLY_CRYPTODLL_ALG -c -o
> cpl_conv.lo cpl_conv.cpp libtool: compile:  g++
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/home/gdt/SOFTWARE/GEO/gdal/gcore
> -I/home/gdt/SOFTWARE/GEO/gdal/alg -I/home/gdt/SOFTWARE/GEO/gdal/ogr
> -I/home/gdt/SOFTWARE/GEO/gdal/ogr/ogrsf_frmts
> -I/home/gdt/SOFTWARE/GEO/gdal/gnm -I/home/gdt/SOFTWARE/GEO/gdal/apps -g
> -O2 -Wall -Wextra -Winit-self -Wunused-parameter -Wformat
> -Werror=format-security -Wno-format-nonliteral -Werror=vla -Wno-clobbered
> -Wmissing-declarations -DOGR_ENABLED -I/usr/pkg/include
> -I/home/gdt/SOFTWARE/GEO/gdal/port -I/usr/pkg/include -DGDAL_COMPILATION
> -I/usr/pkg/include -DHAVE_CURL -DHAVE_LIBZ -I/usr/pkg/include/libxml2
> -DHAVE_LIBXML2 -DUSE_ONLY_CRYPTODLL_ALG -c cpl_conv.cpp  -fPIC -DPIC -o
> .libs/cpl_conv.o cpl_conv.cpp: In function 'GUIntBig CPLScanUIntBig(const
> char*, int)': cpl_conv.cpp:915:30: error: 'atoll' was not declared in this
> scope cpl_conv.cpp: In function 'GIntBig CPLAtoGIntBig(const char*)':
> cpl_conv.cpp:941:29: error: 'atoll' was not declared in this scope
> cpl_conv.cpp: In function 'GIntBig CPLAtoGIntBigEx(const char*, int,
> int*)': cpl_conv.cpp:994:29: error: 'atoll' was not declared in this scope
> cpl_conv.cpp: In function 'GIntBig CPLAtoGIntBig(const char*)':
> cpl_conv.cpp:945:1: warning: control reaches end of non-void function
> ../GDALmake.opt:653: recipe for target 'cpl_conv.lo' failed
> gmake[1]: *** [cpl_conv.lo] Error 1
> gmake[1]: Leaving directory '/usr/home/gdt/SOFTWARE/GEO/gdal/port'
> GNUmakefile:70: recipe for target 'port-target' failed
> gmake: *** [port-target] Error 2

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list