chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
macro.h: let F_TYPE_CMP() macro fail to compile, if second parameter is not const
[elogind.git]
/
src
/
shared
/
macro.h
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index 08b40fd2b8af0e85260ba6a058095c0dd0fb5fd5..2bb72f0d167626413aa5d91c1182050cc41da57d 100644
(file)
--- a/
src/shared/macro.h
+++ b/
src/shared/macro.h
@@
-272,11
+272,12
@@
do { \
* signed int in the kernel and these negative numbers are extended to
* long, which cannot be simply compared to the magic constants anymore.
*/
* signed int in the kernel and these negative numbers are extended to
* long, which cannot be simply compared to the magic constants anymore.
*/
-#define F_TYPE_CMP(f
, c)
\
+#define F_TYPE_CMP(f
_type, magic)
\
__extension__ ({ \
__extension__ ({ \
- __SWORD_TYPE _f = (f); \
- const __SWORD_TYPE _c = (c); \
- const int _c32 = (c); \
+ __SWORD_TYPE _f = (f_type); \
+ const __SWORD_TYPE _c = (magic); \
+ const int _c32 = 1 ? (magic) \
+ : sizeof((int[magic]){0}); \
(_f == _c || _f == _c32 ); \
})
(_f == _c || _f == _c32 ); \
})