chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ask-password: modernizations
[elogind.git]
/
src
/
shared
/
macro.h
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index 458e0ebed30bf6566bb1aac223d89f5c5cb42b9c..d53b07fea5cdc02c45a7d5367df8cb76ec96e574 100644
(file)
--- a/
src/shared/macro.h
+++ b/
src/shared/macro.h
@@
-59,6
+59,10
@@
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"")
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"")
+#define DISABLE_WARNING_NONNULL \
+ _Pragma("GCC diagnostic push"); \
+ _Pragma("GCC diagnostic ignored \"-Wnonnull\"")
+
#define REENABLE_WARNING \
_Pragma("GCC diagnostic pop")
#define REENABLE_WARNING \
_Pragma("GCC diagnostic pop")
@@
-94,7
+98,7
@@
static inline size_t ALIGN_TO(size_t l, size_t ali) {
return ((l + ali - 1) & ~(ali - 1));
}
return ((l + ali - 1) & ~(ali - 1));
}
-#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p))
+#define ALIGN_TO_PTR(p, ali) ((void*) ALIGN_TO((unsigned long) p
, ali
))
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
@@
-320,13
+324,14
@@
do { \
#define SET_FLAG(v, flag, b) \
(v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
#define SET_FLAG(v, flag, b) \
(v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
-#define IN_SET(x,
...)
\
+#define IN_SET(x,
y, ...)
\
({ \
({ \
- const typeof(x) _x = (x); \
+ const typeof(y) _y = (y); \
+ const typeof(_y) _x = (x); \
unsigned _i; \
bool _found = false; \
unsigned _i; \
bool _found = false; \
- for (_i = 0; _i < sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
- if (((const typeof(_x)[]) { __VA_ARGS__ })[_i] == _x) { \
+ for (_i = 0; _i <
1 +
sizeof((const typeof(_x)[]) { __VA_ARGS__ })/sizeof(const typeof(_x)); _i++) \
+ if (((const typeof(_x)[]) { _
y, _
_VA_ARGS__ })[_i] == _x) { \
_found = true; \
break; \
} \
_found = true; \
break; \
} \