#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)
#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) struct UNIQUE(_assert_struct_) { char x[(expr) ? 0 : -1]; };
#endif
#define assert_return(expr, r) \
} \
} while(false)
- /* Because statfs.t_type can be int on some architecures, we have to cast
+ /* Because statfs.t_type can be int on some architectures, we have to cast
* the const magic to the type, otherwise the compiler warns about
* signed/unsigned comparison, because the magic can be 32 bit unsigned.
*/
* specified type as a decimal string. Adds in extra space for a
* negative '-' prefix. */
#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)])))