diff options
author | Yi-Hung Wei <yihung.wei@gmail.com> | 2017-11-01 14:40:27 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-11-02 11:23:38 -0700 |
commit | 274cd1f188de5d751ed014169dae54ed64e5c916 (patch) | |
tree | a1312a85d1bff6fde5e27635e241fdb19eff05f4 /include/openvswitch/util.h | |
parent | 36e6714054534b552413ba3b8e7eab49f965dc29 (diff) | |
download | openvswitch-274cd1f188de5d751ed014169dae54ed64e5c916.tar.gz |
packets: Fix C++ compilation issues when include packets.h
This patch fixes three C++ compilation errors when it includes
"lib/packets.h".
1) Fix in "include/openvswitch/util.h" is to avoid duplicated
named_member__ in struct pkt_metadata.
2) Fix in "lib/packets.h" is because designated initializers are not
implemented in GNU C++ [1].
3) Fix in "lib/util.h" is because __builtin_types_compatible_p and
__builtin_choose_expr are only supported in GCC. I use one solution
for C++ that is type-safe and works at compile time from [2].
[1]: https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
[2]: https://goo.gl/xNe48A
Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'include/openvswitch/util.h')
-rw-r--r-- | include/openvswitch/util.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/openvswitch/util.h b/include/openvswitch/util.h index 84d7e07ff..c3e60d561 100644 --- a/include/openvswitch/util.h +++ b/include/openvswitch/util.h @@ -232,12 +232,12 @@ OVS_NO_RETURN void ovs_assert_failure(const char *, const char *, const char *); uint8_t PAD_ID[ROUND_UP(sizeof(struct { MEMBERS }), UNIT)]; \ } #else -#define PADDED_MEMBERS_CACHELINE_MARKER(UNIT, CACHELINE, MEMBERS) \ - union { \ - OVS_CACHE_LINE_MARKER CACHELINE; \ - struct { MEMBERS }; \ - struct { MEMBERS } named_member__; \ - uint8_t PAD_ID[ROUND_UP(sizeof named_member__, UNIT)]; \ +#define PADDED_MEMBERS_CACHELINE_MARKER(UNIT, CACHELINE, MEMBERS) \ + union { \ + OVS_CACHE_LINE_MARKER CACHELINE; \ + struct { MEMBERS }; \ + struct { MEMBERS } named_member_##CACHELINE; \ + uint8_t PAD_ID[ROUND_UP(sizeof named_member_##CACHELINE, UNIT)]; \ } #endif |