diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-11-22 09:19:00 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-11-22 09:19:00 +0100 |
commit | b5be11e82364d65bec3647e6a26dca482bd6a491 (patch) | |
tree | 61a19fe3adbf4485d9121e21676f272305e5003e /src/shared | |
parent | 5476ad087c0f2d45ab0dab1bab9ef3e9d70418bc (diff) |
macro: fix assert_cc() fallback
We need two-level macro-expansion, otherwise __LINE__ will not get
evaluated.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/macro.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/shared/macro.h b/src/shared/macro.h index c22de91705..aadb1959c0 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -145,7 +145,9 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) { #if defined(static_assert) #define assert_cc(expr) static_assert(expr, #expr) #else -#define assert_cc(expr) struct _assert_struct_ ## __LINE__ { char x[(expr) ? 0 : -1]; } +#define assert___cc(expr, line) struct _assert_struct_ ## line { char x[(expr) ? 0 : -1]; } +#define assert__cc(expr, line) assert___cc((expr), line) +#define assert_cc(expr) assert__cc((expr), __LINE__) #endif #define assert_return(expr, r) \ |