Skip to contentSkip to conversation

eal/windows: fix token pasting build warning

PATCH Applied Tal Shnaiderman 3 participants 3 messages Sep 13, 2021 – Sep 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal/windows: fix token pasting build warning

When building DPDK on Windows in debug mode the following warning appear:

warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments] #define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)

Modified the 'open' macro to avoid it.

Fixes 45d62067c237 ("eal: make OS shims internal")
---
 lib/eal/windows/include/rte_os_shim.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/windows/include/rte_os_shim.h +1 -1
index 33619745ab..eda8113662 100644
@@ -25,7 +25,7 @@
 #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
 #endif
 
-#define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)
+#define open(...) _open(__VA_ARGS__)
 #define read(fd, buf, n) _read(fd, buf, n)
 #define write(fd, buf, n) _write(fd, buf, n)
 #define close(fd) _close(fd)
Signature · 1 line
2.16.1.windows.4
Acked-by on v1 1/1
#1 lore raw

2021-09-13 19:55 (UTC+0300), Tal Shnaiderman:

Quoted 8 lines

When building DPDK on Windows in debug mode the following warning appear:

warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments] #define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)

Modified the 'open' macro to avoid it.

Nit: "Modify" (present tense should be used here).

Quoted 14 lines
Fixes 45d62067c237 ("eal: make OS shims internal")
---
 lib/eal/windows/include/rte_os_shim.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eal/windows/include/rte_os_shim.h +0 -0
index 33619745ab..eda8113662 100644

lib/eal/windows/include/rte_os_shim.h line 31

Quoted 8 lines
lib/eal/windows/include/rte_os_shim.h +1 -1
@@ -25,7 +25,7 @@
 #define strncasecmp(s1, s2, count) _strnicmp(s1, s2, count)
 #endif
 
-#define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)
+#define open(...) _open(__VA_ARGS__)
 #define read(fd, buf, n) _read(fd, buf, n)
 #define write(fd, buf, n) _write(fd, buf, n)
 #define close(fd) _close(fd)

Note: Three-argument form of open() is seldom used in DPDK and only once in OS-independent code. However, rte_os_shim.h can be included in platform-specific file and it should not prevent using 3-argument open(). This patch is probably the most simple and robust thing we can do.

#2 lore raw

15/09/2021 21:25, Dmitry Kozlyuk:

Quoted 26 lines

2021-09-13 19:55 (UTC+0300), Tal Shnaiderman:

Quoted 8 lines

When building DPDK on Windows in debug mode the following warning appear:

warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments] #define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)

Modified the 'open' macro to avoid it.

Nit: "Modify" (present tense should be used here).

lib/eal/windows/include/rte_os_shim.h line 28

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

---

lib/eal/windows/include/rte_os_shim.h +1 -1
-#define open(path, flags, ...) _open(path, flags, ##__VA_ARGS__)
+#define open(...) _open(__VA_ARGS__)

Note: Three-argument form of open() is seldom used in DPDK and only once in OS-independent code. However, rte_os_shim.h can be included in platform-specific file and it should not prevent using 3-argument open(). This patch is probably the most simple and robust thing we can do.

Quoted 1 line

Applied, thanks.