diff options
author | Zoltan Kiss <zoltan.kiss@linaro.org> | 2015-01-22 18:32:35 +0000 |
---|---|---|
committer | Zoltan Kiss <zoltan.kiss@linaro.org> | 2015-01-22 18:32:35 +0000 |
commit | e8eed6169be337438dbeedb7a45487eb04944faa (patch) | |
tree | 73219995b7dd0bcdc8c83e97483bfcc1b9d6e4fa | |
parent | 60b9c3ceb49fc09bee78c21ea1fcfbd30f6d94e0 (diff) |
odp_debug.h: backward compatible _Static_assert
Porting commit from linux-generic (3ee9)
-rw-r--r-- | platform/linux-dpdk/include/api/odp_debug.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/platform/linux-dpdk/include/api/odp_debug.h b/platform/linux-dpdk/include/api/odp_debug.h index c61611cd1..b04f55ea1 100644 --- a/platform/linux-dpdk/include/api/odp_debug.h +++ b/platform/linux-dpdk/include/api/odp_debug.h @@ -31,6 +31,17 @@ extern "C" { */ #define ODP_UNUSED __attribute__((__unused__)) +#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) + +/** + * _Static_assert was only added in GCC 4.6. Provide a weak replacement + * for previous versions. + */ +#define _Static_assert(e, s) extern int (*static_assert_checker (void)) \ + [sizeof (struct { unsigned int error_if_negative: (e) ? 1 : -1; })] + +#endif + #else #define ODP_DEPRECATED |