chiark / gitweb /
calendar: support 'yearly' and 'annually' names the same way as cron
[elogind.git] / src / shared / macro.h
index d3f4245d5d0c0a72f503e34850796a4a1af2908b..c22de91705fb51b26a74b3075f04d9710969bf75 100644 (file)
@@ -143,24 +143,14 @@ 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)                    \
         do {                                      \
-                if (!(expr))                      \
+                if (_unlikely_(!(expr)))          \
                         return (r);               \
         } while (false)
 
@@ -278,11 +268,9 @@ do {                                                                    \
  */
 #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. */
-
 #define DECIMAL_STR_MAX(type)                                           \
         (1+(sizeof(type) <= 1 ? 3 :                                     \
             sizeof(type) <= 2 ? 5 :                                     \