[PROJ] Why is std=gnu89 tested/enabled ?

Dechaux Eric CEN (BCQ STIG) eric.dechaux at gendarmerie.interieur.gouv.fr
Wed Aug 21 04:55:33 PDT 2019


Thanks Kristian,

On Solaris, NAN is not available with C89. Is there an issue to build 
proj 5 forcing C99 by replacing -std=c89 to -std=c99 in the Makefile, 
after configure ?


Regards.


Le 21/08/2019 à 12:43, Kristian Evers a écrit :
> Eric,
>
> A C++11 compatible compiler is only required for PROJ 6 and onwards. 
> This was introduced with RFC3 [0]. Previous versions was strictly C89, 
> hence the enforcement of that standard in PROJ 5.2.0.
>
> /Kristian
>
> [0] https://proj.org/community/rfc/rfc-3.html
>
>> On 16 Aug 2019, at 14:57, Dechaux Eric CEN (BCQ STIG) 
>> <eric.dechaux at gendarmerie.interieur.gouv.fr 
>> <mailto:eric.dechaux at gendarmerie.interieur.gouv.fr>> wrote:
>>
>> Greetings,
>>
>> I have been investigating proj 5.2.0 build failure on Solaris 11.3 
>> for amd64. At some point the build stops on error because of the NAN 
>> being not declared :
>>
>> gcc -DHAVE_CONFIG_H -I. 
>> -DPROJ_LIB=\"/appli/stig/11.3-20190816-104632/share/proj\" 
>> -DMUTEX_pthread  -D_FORTIFY_SOURCE=2 -I/usr/include/pcre 
>> -I/appli/stig/11.3-20190816-104632/include -Wall 
>> -Wdeclaration-after-statement -Wextra -Winit-self -Wunused-parameter 
>> -Wmissing-prototypes -Wmissing-declarations -Wformat 
>> -Werror=format-security -Wno-format-nonliteral -Wlogical-op -Wshadow 
>> -Werror=vla -Wdeclaration-after-statement -Wdate-time 
>> -Wfloat-conversion -std=gnu89 -m64 -O2 -fstack-protector-strong -fpic 
>> -fPIC --param=ssp-buffer-size=4 
>> -I/appli/stig/11.3-20190816-104632/include -DHAVE_C99_MATH=1 -MT 
>> proj_strtod.o -MD -MP -MF .deps/proj_strtod.Tpo -c -o proj_strtod.o 
>> proj_strtod.c
>> gie.c: In function ‘cart_selftest’:
>> gie.c:2008:20: error: ‘NAN’ undeclared (first use in this function)
>>      a = proj_coord(NAN, NAN, NAN, NAN);
>>                     ^
>> gie.c:2008:20: note: each undeclared identifier is reported only once 
>> for each function it appears in
>> make[2]: *** [gie.o] Erreur 1
>>
>>
>> As the documentation specify a C and C++11 compiler is required I 
>> changed the CFLAGS to include -std=gnu11. The build and checks run 
>> without errror. Solaris 11.3 is bundled with GCC 5.3 with uses gnu11 
>> by default for C and there should be no reason to force for it on the 
>> CFLAGS.
>>
>> I noticed the configure script detects and automatically adds 
>> -std=gnu89 to the CFLAGS :
>>
>>     checking whether C compiler accepts -Wdocumentation 
>> -Wno-documentation-deprecated-sync... no
>>     checking if -std=gnu89 can be enabled... yes
>>     checking whether C++ compiler accepts -Wunused-private-field... no
>>
>>
>> On Solaris this disables the NAN macro as it is C99:
>>
>> $ cat test.c
>> #include <stdlib.h>
>> #include <math.h>
>>
>> int main (void) {
>>
>>         float f ;
>>         f = NAN ;
>>
>>
>>         exit (EXIT_SUCCESS) ;
>> }
>>
>> $ gcc -std=gnu89 test.c
>> test.c: In function ‘main’:
>> test.c:7:6: error: ‘NAN’ undeclared (first use in this function)
>>   f = NAN ;
>>       ^
>> test.c:7:6: note: each undeclared identifier is reported only once 
>> for each function it appears in
>>
>> $ gcc -std=gnu99 test.c
>>
>> $ gcc -std=gnu11 test.c
>>
>>
>>
>> What is the purpose of forcing C standard to gnu89  ?
>>
>>
>>
>> Thanks.
>>
>> -- Eric
>>
>>
>> Ce message �lectronique et tous les fichiers attach�s qu'il contient 
>> sont confidentiels et destin�s exclusivement � l'usage de la personne 
>> � laquelle ils sont adress�s. Si vous avez re�u ce message par 
>> erreur, merci de le retourner � son �metteur. La publication, 
>> l'usage, la distribution, l'impression ou la copie non autoris�e de 
>> ce message et des attachements qu'il contient sont strictement interdits.
>>
>> En cas d'urgence, composez le 17 ou le 112.
>> Afin de contribuer au respect de l'environnement, merci de n'imprimer 
>> cet e-mail qu'en cas de necessite.
>>
>> This e-mail and any files transmitted with it are confidential and 
>> intended solely for the use of the individual to whom it is 
>> addressed. If you have received this email in error please send it 
>> back to the person that sent it to you. Unauthorized publication, 
>> use, dissemination, forwarding, printing or copying of this email and 
>> its associated attachments is strictly prohibited.
>>
>> In case of emergency, dial number 17 or 112.
>> To contribute to the environmental protection, please print this 
>> e-mail only if necessary.
>> _______________________________________________
>> PROJ mailing list
>> PROJ at lists.osgeo.org <mailto:PROJ at lists.osgeo.org>
>> https://lists.osgeo.org/mailman/listinfo/proj
>

-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20190821/65142ffe/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.png
Type: image/png
Size: 38572 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20190821/65142ffe/attachment-0001.png>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: avertissement.txt
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20190821/65142ffe/attachment-0001.txt>


More information about the PROJ mailing list