[dpdk-dev] [PATCH] eal/windows: fix build warnings in MinGW
Dmitry Kozlyuk
dmitry.kozliuk at gmail.com
Mon Apr 19 20:55:23 CEST 2021
2021-04-19 06:57 (UTC+0000), Tal Shnaiderman:
> [...]
> > > > 18/04/2021 19:08, Tal Shnaiderman:
> > > > > the strncasecmp marco defined in rte_os_shim.h is already defined
> > > > > in MinGW-w64, as a result the compiler prints out the warning
> > > > > below on function redefinition whenever compiling a file including the
> > header.
> > > > >
> > > > > ..\lib/librte_eal/windows/include/rte_os_shim.h:21:
> > > > > warning: "strncasecmp" redefined
> > > > > #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
> > > >
> > > > Why the tests are passing? Are we allowing warnings in build test?
> > >
> > > It's a good question, I see CI is passing without warnings, Dmitry can you
> > reproduce it?
> > >
> > > On my side the collision is with the following file:
> > >
> > > C:/mingw-w64/x86_64/mingw64/x86_64-w64-
> > mingw32/include/string.h:119:
> > > note: this is the location of the previous definition #define
> > > strncasecmp _strnicmp
> > >
> > > I'm using:
> > > -gcc (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 8.1.0 -meson
> > > 0.53.2
> >
> > I can't reproduce it using the same versions.
> > Do you invoke meson with other options than "-Dexamples=..."?
>
> This is the meson line I'm using:
>
> meson "-Dexamples=helloworld" build --wipe --default-library=static --buildtype debug
>
> The problem however is that MinGW's string.h defines the macro in line 119, for some reason my build includes it and the rest doesn't.
--default-library=static it the key, it changes MinGW from using inline
functions to using macros for strncasecmp().
MinGW portion devtools/check-meson-builds.sh should test this variant.
I searched for other defines from rte_os_shim.h in MinGW includes and it
seems strncasecmp() is the only problematic one. Thanks, I'm ready to ack v2
as soon as you send it.
More information about the dev
mailing list