diff options
author | 2019-01-21 13:25:59 +0100 | |
---|---|---|
committer | 2019-01-21 15:35:34 +0100 | |
commit | 8a2e408a3fc20f1055a8ca796a4d32ebc9fb9aa0 (patch) | |
tree | 6924ea2da917504e9381cf54ce976e56ff66d0dd /lib/src/common.h | |
parent | 29fb58203e5a44dbfafc6b788f50ca412c5f3c4b (diff) |
HICN-4 - Fix Windows compilation issue with named struct initializers
Change-Id: I9c9e8780ec1132d3d74b6202b9b142ed64b4e13f
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'lib/src/common.h')
-rwxr-xr-x | lib/src/common.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/src/common.h b/lib/src/common.h index 9ddbdeb09..dd488d43b 100755 --- a/lib/src/common.h +++ b/lib/src/common.h @@ -63,6 +63,25 @@ typedef uint8_t u8; #endif /* ! HICN_VPP_PLUGIN */ /* + * Windows compilers do not support named initilizers when .h files are included + * inside C++ files. For readability, we either use the following macro, or + * duplicate some code, with the intent of preserving those safeguards for + * non-Windows platforms. + */ +#ifndef _WIN32 +#define ATTR_INIT(key, value) .key = value +#else +#define ATTR_INIT(key, value) value +#endif + +/* Endianness detection for Windows platforms */ +#ifdef _WIN32 +#define __ORDER_LITTLE_ENDIAN__ 0x41424344UL +#define __ORDER_BIG_ENDIAN__ 0x44434241UL +#define __BYTE_ORDER__ ('ABCD') +#endif + +/* * IP address types */ |