Message ID | 20180125181208.16676-1-rams@vmware.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] openvswitch/types.h: Drop the member name in initializer macro | expand |
On Thu, Jan 25, 2018 at 10:12:08AM -0800, Shashank Ram wrote: > 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@vmware.com> > Tested-by: Yi-Hung Wei <yihung.wei@gmail.com> Applied to master and branch-2.9, thanks!
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 }