[gdal-dev] stricmp in cpl_port.h

Even Rouault even.rouault at spatialys.com
Wed Apr 7 08:54:34 PDT 2021


You're welcome to submit a pull request changing stricmp by _stricmp so 
that we can check that our CI is happy with that. Given than we only 
support MSVC >= 2015 nowadays, I'd expect this to run smoothly.

Le 07/04/2021 à 16:24, Andrew C Aitchison a écrit :
>
> I have developed a gdal driver plugin on Linux and am now attempting 
> to build it on Windows.
> I am using the conda gdal, WIN10 SDK and the mingw-m64 clang11 compiler
> (all installed this week, latest versions I believe), but am open to
> other suggestions for building a windows gdal driver plugin.
>
> I get a deprecation warning from cpl_port.h when I use the EQUALS macro:
> ----------------------------------------------------------------------
> qed.cpp:569:31: warning: 'stricmp' is deprecated: The POSIX name for 
> this item is deprecated. Instead, use the ISO C and
>        C++ conformant name: _stricmp. See online help for details. 
> [-Wdeprecated-declarations]
>      if( magic == qed_magic && 
> EQUAL(CPLGetExtension(poOpenInfo->pszFilename),"qed")) {
>                                ^
> C:\ProgramData\Miniconda3\Library\include/cpl_port.h:576:36: note: 
> expanded from macro 'EQUAL'
> #  define EQUAL(a,b)              (STRCASECMP(a,b)==0)
>                                     ^
> C:\ProgramData\Miniconda3\Library\include/cpl_port.h:565:38: note: 
> expanded from macro 'STRCASECMP'
> #    define STRCASECMP(a,b)         (stricmp(a,b))
>                                       ^
> C:\Program Files (x86)\Windows 
> Kits\10\Include\10.0.19041.0\ucrt\string.h:544:20: note: 'stricmp' has 
> been explicitly
>        marked deprecated here
>      _Check_return_ _CRT_NONSTDC_DEPRECATE(_stricmp)
>                     ^
> C:\Program Files (x86)\Windows 
> Kits\10\Include\10.0.19041.0\ucrt\corecrt.h:414:50: note: expanded 
> from macro
>        '_CRT_NONSTDC_DEPRECATE'
>          #define _CRT_NONSTDC_DEPRECATE(_NewName) _CRT_DEPRECATE_TEXT( \
>                                                   ^
> C:\Program Files (x86)\Microsoft Visual 
> Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vcruntime.h:310:47: 
> note:
>        expanded from macro '_CRT_DEPRECATE_TEXT'
> #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
>                                                ^
> 1 warning generated.
> -----------------------------------------------------------------------
>
> Should cpl_port be updated to use _stricmp or is there a better 
> alternative (I wondered about strcasecmp but don't see it) ?
>
> I see that
>      frmts/mrsid_lidar/makefile.vc
> sets
>      EXTRAFLAGS = $(MRSID_INCLUDE) -D_CRT_SECURE_NO_WARNINGS /Zc:wchar_t-
> but I would rather not turn off warnings, since my code is clean 
> enough to use  -Wall -Wextra -Weverything on linux.
>
> Thanks.
>
-- 
http://www.spatialys.com
My software is free, but my time generally not.



More information about the gdal-dev mailing list