[gdal-dev] stricmp in cpl_port.h

Andrew C Aitchison andrew at aitchison.me.uk
Wed Apr 7 08:47:54 PDT 2021


On Wed, 7 Apr 2021, Andrew Bell wrote:

> Dare I suggest getting rid of EQUAL?

Since the purpose of EQUALS is to compare two strings, that would
be passing the buck. Without it developers would have to solve this
issue for each platform each time, making it more likely that someone
would break a platform that they don't use.


> On Wed, Apr 7, 2021 at 10:25 AM Andrew C Aitchison <andrew at aitchison.me.uk>
> wrote:
>
>>
>> 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.
>>
>> --
>> Andrew C. Aitchison                                      Kendal, UK
>>                         andrew at aitchison.me.uk
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
> -- 
> Andrew Bell
> andrew.bell.ia at gmail.com
>

-- 
Andrew C. Aitchison					Kendal, UK
 			andrew at aitchison.me.uk


More information about the gdal-dev mailing list