Ticket #161 (closed defect: wontfix)
Request to add CFLAG -Werror=declaration-after-statement
Reported by: | jmckenna | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Development platform | Version: | |
Keywords: | Cc: | jmckenna@… |
Description
The C89 requirement is a wall that is hit by many software projects (PROJ.4, GDAL, MapServer/MapCache?) as many different compilers support different standards.
MapServer/MapCache? recently added the -Werror=declaration-after-statement to avoid compiler errors when variables are not declared at the beginning of the block: https://github.com/mapserver/mapcache/commit/219e54b45e4730b91111a6874e435a8ca8a1aa6d
Even Rouault recently mentioned that PROJ.4 also uses that flag, which is based on the GDAL use of it also: https://github.com/OSGeo/proj.4/blob/master/m4/ax_cflags_warn_all.m4#L35
Here are more ZOO-Project compile errors on Windows:
d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(273) : error C2061: syntax error : identifier 'hasKey' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(273) : error C2059: syntax error : ';' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(273) : error C2059: syntax error : 'type' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(285) : error C2061: syntax error : identifier 'hasElement' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(285) : error C2059: syntax error : ';' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(285) : error C2059: syntax error : 'type' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(297) : error C2061: syntax error : identifier 'contains' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(297) : error C2059: syntax error : ';' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(297) : error C2059: syntax error : 'type' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(316) : error C2061: syntax error : identifier 'addServiceToRegistry' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(316) : error C2059: syntax error : ';' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(316) : error C2059: syntax error : 'type' d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(328) : warning C4273: '_snprintf' : inconsistent dll linkage C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdio.h(349) : see previous definition of '_snprintf' ulinet.c(92) : error C2143: syntax error : missing ';' before 'type' ulinet.c(93) : error C2275: '_HINTERNET' : illegal use of this type as an expression d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\ulinet.h(87) : see declaration of '_HINTERNET' ulinet.c(93) : error C2065: 'psInternet' : undeclared identifier ulinet.c(94) : error C2065: 'psInternet' : undeclared identifier ulinet.c(94) : warning C4047: '!=' : 'int' differs in levels of indirection from 'void *' ulinet.c(95) : error C2065: 'psInternet' : undeclared identifier ulinet.c(95) : error C2223: left of '->cookie' must point to struct/union ulinet.c(96) : error C2065: 'psInternet' : undeclared identifier ulinet.c(96) : error C2223: left of '->cookie' must point to struct/union ulinet.c(246) : warning C4013: 'strtok_r' undefined; assuming extern returning int ulinet.c(246) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int' ulinet.c(247) : error C2143: syntax error : missing ';' before 'type' ulinet.c(248) : error C2143: syntax error : missing ';' before 'type' ulinet.c(249) : error C2065: 'cnt' : undeclared identifier ulinet.c(251) : error C2065: 'cnt' : undeclared identifier ulinet.c(254) : error C2065: 'cnt' : undeclared identifier ulinet.c(258) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int' ulinet.c(259) : error C2065: 'cnt' : undeclared identifier ulinet.c(281) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int' ulinet.c(282) : error C2143: syntax error : missing ';' before 'type' ulinet.c(283) : error C2065: 'i' : undeclared identifier ulinet.c(284) : error C2065: 'i' : undeclared identifier ulinet.c(289) : error C2143: syntax error : missing ';' before 'type' ulinet.c(290) : error C2065: 'j' : undeclared identifier ulinet.c(291) : error C2065: 'j' : undeclared identifier ulinet.c(292) : error C2065: 'j' : undeclared identifier ulinet.c(292) : error C2065: 'i' : undeclared identifier ulinet.c(294) : error C2065: 'j' : undeclared identifier ulinet.c(295) : error C2065: 'j' : undeclared identifier ulinet.c(298) : error C2275: 'map' : illegal use of this type as an expression d:\build\mapserver-buildkit-2012\zoo-project-svn-20170731\zoo-project\zoo-kernel\service.h(191) : see declaration of 'map' ulinet.c(298) : error C2065: 'tmpMap' : undeclared identifier ulinet.c(299) : error C2065: 'tmpMap' : undeclared identifier ulinet.c(299) : warning C4047: '!=' : 'int' differs in levels of indirection from 'void *' ulinet.c(300) : error C2065: 'i' : undeclared identifier ulinet.c(300) : error C2065: 'tmpMap' : undeclared identifier ulinet.c(300) : error C2223: left of '->value' must point to struct/union ulinet.c(300) : error C2198: 'AddMissingHeaderEntry' : too few arguments for call ulinet.c(302) : error C2065: 'i' : undeclared identifier ulinet.c(303) : error C2065: 'i' : undeclared identifier ulinet.c(305) : warning C4047: '=' : 'char *' differs in levels of indirection from 'int' ulinet.c(539) : warning C4018: '<' : signed/unsigned mismatch NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.EXE"' : return code '0x2' Stop.