[ovs-dev] [PATCH] openvswitch/types.h: Drop the member name in initializer macro
Shashank Ram
rams at vmware.com
Thu Jan 25 18:12:08 UTC 2018
MSVC++ compiler does not allow initializing a struct while
explicitly initializing a member in the struct.
Not allowed:
static const struct eth_addr a = {{ .ea= { 0xff, 0xff, 0xff, 0xff,
0xff, 0xff }}};
Alowed:
static const struct eth_addr b = {{{ 0xff, 0xff, 0xff, 0xff, 0xff,
0xff }}};
*An extra curly brace is required for GCC in case the struct contains
a union.
Signed-off-by: Shashank Ram <rams at vmware.com>
Tested-by: Yi-Hung Wei <yihung.wei at gmail.com>
---
include/openvswitch/types.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/openvswitch/types.h b/include/openvswitch/types.h
index b8b4fa9..45e7079 100644
--- a/include/openvswitch/types.h
+++ b/include/openvswitch/types.h
@@ -171,7 +171,7 @@ struct eth_addr {
/* Ethernet address constant, e.g. ETH_ADDR_C(01,23,45,67,89,ab) is
* 01:23:45:67:89:ab. */
#define ETH_ADDR_C(A,B,C,D,E,F) \
- { { .ea = { 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##F } } }
+ { { { 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##F } } }
/* Similar to struct eth_addr, for EUI-64 addresses. */
struct eth_addr64 {
@@ -184,8 +184,7 @@ struct eth_addr64 {
/* EUI-64 address constant, e.g. ETH_ADDR_C(01,23,45,67,89,ab,cd,ef) is
* 01:23:45:67:89:ab:cd:ef. */
#define ETH_ADDR64_C(A,B,C,D,E,F,G,H) \
- { { .ea64 = { 0x##A, 0x##B, 0x##C, 0x##D, \
- 0x##E, 0x##F, 0x##G, 0x##H} } }
+ { { { 0x##A, 0x##B, 0x##C, 0x##D, 0x##E, 0x##F, 0x##G, 0x##H } } }
#ifdef __cplusplus
}
--
2.9.3.windows.2
More information about the dev
mailing list