Re: build failure with GCC 9.1.0

"Dechaux Eric CEN (BCQ STIG)" <[email protected]>
Newsgroups gmane.comp.gis.proj-4.devel
Message-ID <3a3fc00a-dc77-3c04-8e6a-6c556f423504@gendarmerie.interieur.gouv.fr>
Le 25/09/2019 à 10:49, Even Rouault a écrit :
>> I am afraid it is not enough. Please find attached 4 additional patches :
>>
>>       - proj-6.2.0-hanato.gpatch and proj-6.2.0-mbtfpp.gpatch
>>
>> In files src/projections/hatano.cpp and src/projections/mbtfpp.cpp,
>> change the CS define to CSz in order to avoid overriding the CS system
>> definition
> ok for those ones.
>
>>       - proj-6.2.0-isea.gpatch :
>>
>> In file src/projections/isea.cpp, change the quad variable name as it is
>> overriding another system definition
>>
>> $ grep quad  /usr/include/sys/types.h
>> typedef struct _quad { int val[2]; } quad_t;    /* used by UFS */
>> typedef quad_t          quad;                   /* used by UFS */
>>
> I'm quite surprised about that one. The compiler should be smart enough to see
> that in "int quad;" quad is a variable name, not a struct. Which error message
> do you get exactly ?
>
> Can you try to compile the following test.cpp file ?
>
> ```
> typedef struct _quad { int val[2]; } quad_t;    /* used by UFS */
> typedef quad_t          quad;                   /* used by UFS */
>
> struct foo
> {
>      int quad;
> };
>
> int main()
> {
>      int quad = 0;
>      return quad;
> }
> ```
>
> $ g++ -std=c++11 test.cpp -c
>
> Works fine on Linux. If adding, -Wshadow, it will complain though about the
> int quad = 0 shadowing the global declaration of typedef quad_t quad;
This exact code does not produce any error or warning. With -Wshadow 
enabled, it produce the followingoutput :

$ g++ -std=c++11 test.cpp -o test -Wshadow
test.cpp: In function 'int main()':
test.cpp:11:9: warning: declaration of 'quad' shadows a global 
declaration [-Wshadow]
    11 |     int quad = 0;
       |         ^~~~
test.cpp:2:25: note: shadowed declaration is here
     2 | typedef quad_t          quad;                   /* used by UFS */
       |                         ^~~~

The patch only removes the warning.

>
>
>>       - proj-6.2.0-io.gpatch
> It is essentially the same as my pull request, or am I missing somethig ?
>
>> Note : I quite understood what I changed in the first 3 patches. Not
>> sure in the last one. Can you please review it ?
> Which one do you mean by the last one, the one for io.cpp ?

Yes, io.ccp. The patch applies above your pull request and change the CS 
class name in two templates

  template <class TargetCRS, class DatumBuilderType,
               class CS = CoordinateSystem>
      util::nn<std::shared_ptr<TargetCRS>>

and

template <class TargetCRS, class BaseCRS, class CS = CoordinateSystem>


--
Eric

_______________________________________________
PROJ mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/proj
avertissement.txt (text/plain, 1.1 KB)
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.