chiark / gitweb /
macro: clean up usage of gcc attributes
[elogind.git] / src / shared / macro.h
index d4f92b60ec83ac37a88d932cf817d3d71413a308..3cf17bb8675b59b8b6b9f8d36bcc5c0c1fee16c7 100644 (file)
@@ -27,7 +27,7 @@
 #include <sys/uio.h>
 #include <inttypes.h>
 
-#define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
+#define _printf_(a,b) __attribute__ ((format (printf, a, b)))
 #define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__)))
 #define _sentinel_ __attribute__ ((sentinel))
 #define _noreturn_ __attribute__((noreturn))
@@ -159,6 +159,12 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) {
         } while (false)
 #endif
 
+#define assert_return(expr, r)                    \
+        do {                                      \
+                if (!(expr))                      \
+                        return (r);               \
+        } while (false)
+
 #define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
 #define INT_TO_PTR(u) ((void *) ((intptr_t) (u)))
 #define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))