chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fd1b903
)
macro: change assert_cc() so that it can appear outside of functions
author
Lennart Poettering
<lennart@poettering.net>
Tue, 19 Nov 2013 00:10:22 +0000
(
01:10
+0100)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 20 Nov 2013 18:36:14 +0000
(19:36 +0100)
src/shared/macro.h
patch
|
blob
|
history
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index 9e94495dd6f5760c884c3bd345bf9fa3fe181630..37cdff1cb3065456aad3183359183b7edae58adb 100644
(file)
--- a/
src/shared/macro.h
+++ b/
src/shared/macro.h
@@
-143,19
+143,9
@@
static inline size_t ALIGN_TO(size_t l, size_t ali) {
} while (false)
#if defined(static_assert)
-#define assert_cc(expr) \
- do { \
- static_assert(expr, #expr); \
- } while (false)
+#define assert_cc(expr) static_assert(expr, #expr)
#else
-#define assert_cc(expr) \
- do { \
- switch (0) { \
- case 0: \
- case !!(expr): \
- ; \
- } \
- } while (false)
+#define assert_cc(expr) struct _assert_struct_ ## __LINE__ { char x[(expr) ? 0 : -1]; }
#endif
#define assert_return(expr, r) \