chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove some unused variables
[elogind.git]
/
src
/
shared
/
macro.h
diff --git
a/src/shared/macro.h
b/src/shared/macro.h
index 3cf17bb8675b59b8b6b9f8d36bcc5c0c1fee16c7..6caecab29538c3983e655b4f806efc6a88bbd466 100644
(file)
--- a/
src/shared/macro.h
+++ b/
src/shared/macro.h
@@
-44,7
+44,6
@@
#define _public_ __attribute__ ((visibility("default")))
#define _hidden_ __attribute__ ((visibility("hidden")))
#define _weakref_(x) __attribute__((weakref(#x)))
#define _public_ __attribute__ ((visibility("default")))
#define _hidden_ __attribute__ ((visibility("hidden")))
#define _weakref_(x) __attribute__((weakref(#x)))
-#define _introspect_(x) __attribute__((section("introspect." x)))
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
#define _cleanup_(x) __attribute__((cleanup(x)))
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
#define _cleanup_(x) __attribute__((cleanup(x)))
@@
-54,6
+53,11
@@
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
+#define XCONCATENATE(x, y) x ## y
+#define CONCATENATE(x, y) XCONCATENATE(x, y)
+
+#define UNIQUE(prefix) CONCATENATE(prefix, __LINE__)
+
/* Rounds up */
#define ALIGN4(l) (((l) + 3) & ~3)
/* Rounds up */
#define ALIGN4(l) (((l) + 3) & ~3)
@@
-144,24
+148,14
@@
static inline size_t ALIGN_TO(size_t l, size_t ali) {
} while (false)
#if defined(static_assert)
} 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
#else
-#define assert_cc(expr) \
- do { \
- switch (0) { \
- case 0: \
- case !!(expr): \
- ; \
- } \
- } while (false)
+#define assert_cc(expr) struct UNIQUE(_assert_struct_) { char x[(expr) ? 0 : -1]; };
#endif
#define assert_return(expr, r) \
do { \
#endif
#define assert_return(expr, r) \
do { \
- if (
!(expr))
\
+ if (
_unlikely_(!(expr)))
\
return (r); \
} while (false)
return (r); \
} while (false)
@@
-279,13
+273,11
@@
do { \
*/
#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
*/
#define F_TYPE_EQUAL(a, b) (a == (typeof(a)) b)
-
/* Returns the number of chars needed to format variables of the
* specified type as a decimal string. Adds in extra space for a
* negative '-' prefix. */
/* Returns the number of chars needed to format variables of the
* specified type as a decimal string. Adds in extra space for a
* negative '-' prefix. */
-
#define DECIMAL_STR_MAX(type) \
#define DECIMAL_STR_MAX(type) \
- (
1
+(sizeof(type) <= 1 ? 3 : \
+ (
2
+(sizeof(type) <= 1 ? 3 : \
sizeof(type) <= 2 ? 5 : \
sizeof(type) <= 4 ? 10 : \
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
sizeof(type) <= 2 ? 5 : \
sizeof(type) <= 4 ? 10 : \
sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))