[v2] eal/windows: fix build warnings in MinGW

Message ID 20210421160942.17700-1-talshn@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] eal/windows: fix build warnings in MinGW |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues
ci/github-robot success github build: passed
ci/iol-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS

Commit Message

Tal Shnaiderman April 21, 2021, 4:09 p.m. UTC
  the strncasecmp macro 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 in debug mode.

..\lib/librte_eal/windows/include/rte_os_shim.h:21:
warning: "strncasecmp" redefined
#define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)

Fixed by defining the macro only to the clang compiler.

Fixes: 45d62067c237 ("eal: make OS shims internal")

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
v2: fix commit message typo [Thomas]
---
 lib/librte_eal/windows/include/rte_os_shim.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Dmitry Kozlyuk April 26, 2021, 3:58 p.m. UTC | #1
2021-04-21 19:09 (UTC+0300), Tal Shnaiderman:
> the strncasecmp macro 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 in debug mode.
> 
> ..\lib/librte_eal/windows/include/rte_os_shim.h:21:
> warning: "strncasecmp" redefined
> #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
> 
> Fixed by defining the macro only to the clang compiler.
> 
> Fixes: 45d62067c237 ("eal: make OS shims internal")
> 
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>

With librte_eal -> eal fixup,
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
  
Thomas Monjalon May 4, 2021, 5:17 p.m. UTC | #2
26/04/2021 17:58, Dmitry Kozlyuk:
> 2021-04-21 19:09 (UTC+0300), Tal Shnaiderman:
> > the strncasecmp macro 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 in debug mode.
> > 
> > ..\lib/librte_eal/windows/include/rte_os_shim.h:21:
> > warning: "strncasecmp" redefined
> > #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
> > 
> > Fixed by defining the macro only to the clang compiler.
> > 
> > Fixes: 45d62067c237 ("eal: make OS shims internal")
> > 
> > Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> 
> With librte_eal -> eal fixup,
> Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Applied, thanks.
  

Patch

diff --git a/lib/librte_eal/windows/include/rte_os_shim.h b/lib/librte_eal/windows/include/rte_os_shim.h
index f40fb62d1d..db0ea6f1b3 100644
--- a/lib/librte_eal/windows/include/rte_os_shim.h
+++ b/lib/librte_eal/windows/include/rte_os_shim.h
@@ -17,7 +17,9 @@ 
 
 #define strdup(str) _strdup(str)
 #define strtok_r(str, delim, saveptr) strtok_s(str, delim, saveptr)
+#ifndef RTE_TOOLCHAIN_GCC
 #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
+#endif
 
 #define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)
 #define read(fd, buf, n) _read(fd, buf, n)