summaryrefslogtreecommitdiff
path: root/src/basic/macro.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/macro.h')
-rw-r--r--src/basic/macro.h55
1 files changed, 18 insertions, 37 deletions
diff --git a/src/basic/macro.h b/src/basic/macro.h
index c52d8e4e3f..b529fb15ff 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -8,30 +8,30 @@
#include <sys/sysmacros.h>
#include <sys/types.h>
-#define _printf_(a, b) __attribute__ ((format (printf, a, b)))
+#define _printf_(a, b) __attribute__ ((__format__(printf, a, b)))
#ifdef __clang__
# define _alloc_(...)
#else
-# define _alloc_(...) __attribute__ ((alloc_size(__VA_ARGS__)))
+# define _alloc_(...) __attribute__ ((__alloc_size__(__VA_ARGS__)))
#endif
-#define _sentinel_ __attribute__ ((sentinel))
-#define _unused_ __attribute__ ((unused))
-#define _destructor_ __attribute__ ((destructor))
-#define _pure_ __attribute__ ((pure))
-#define _const_ __attribute__ ((const))
-#define _deprecated_ __attribute__ ((deprecated))
-#define _packed_ __attribute__ ((packed))
-#define _malloc_ __attribute__ ((malloc))
-#define _weak_ __attribute__ ((weak))
+#define _sentinel_ __attribute__ ((__sentinel__))
+#define _unused_ __attribute__ ((__unused__))
+#define _destructor_ __attribute__ ((__destructor__))
+#define _pure_ __attribute__ ((__pure__))
+#define _const_ __attribute__ ((__const__))
+#define _deprecated_ __attribute__ ((__deprecated__))
+#define _packed_ __attribute__ ((__packed__))
+#define _malloc_ __attribute__ ((__malloc__))
+#define _weak_ __attribute__ ((__weak__))
#define _likely_(x) (__builtin_expect(!!(x), 1))
#define _unlikely_(x) (__builtin_expect(!!(x), 0))
-#define _public_ __attribute__ ((visibility("default")))
-#define _hidden_ __attribute__ ((visibility("hidden")))
-#define _weakref_(x) __attribute__((weakref(#x)))
-#define _alignas_(x) __attribute__((aligned(__alignof(x))))
-#define _cleanup_(x) __attribute__((cleanup(x)))
+#define _public_ __attribute__ ((__visibility__("default")))
+#define _hidden_ __attribute__ ((__visibility__("hidden")))
+#define _weakref_(x) __attribute__((__weakref__(#x)))
+#define _alignas_(x) __attribute__((__aligned__(__alignof(x))))
+#define _cleanup_(x) __attribute__((__cleanup__(x)))
#if __GNUC__ >= 7
-#define _fallthrough_ __attribute__((fallthrough))
+#define _fallthrough_ __attribute__((__fallthrough__))
#else
#define _fallthrough_
#endif
@@ -41,7 +41,7 @@
#if __STDC_VERSION__ >= 201112L
#define _noreturn_ _Noreturn
#else
-#define _noreturn_ __attribute__((noreturn))
+#define _noreturn_ __attribute__((__noreturn__))
#endif
#endif
@@ -506,23 +506,4 @@ static inline int __coverity_check__(int condition) {
DEFINE_PUBLIC_TRIVIAL_REF_FUNC(type, name); \
DEFINE_PUBLIC_TRIVIAL_UNREF_FUNC(type, name, free_func);
-/* Negative return values from impl are mapped to EXIT_FAILURE, and
- * everything else means success! */
-#define DEFINE_MAIN_FUNCTION(impl) \
- int main(int argc, char *argv[]) { \
- int r; \
- r = impl(argc, argv); \
- return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; \
- }
-
-/* Zero is mapped to EXIT_SUCCESS, and both negative and positive values
- * are mapped to EXIT_FAILURE.
- * Note: this means "true" maps to EXIT_FAILURE. */
-#define DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(impl) \
- int main(int argc, char *argv[]) { \
- int r; \
- r = impl(argc, argv); \
- return r != 0 ? EXIT_FAILURE : EXIT_SUCCESS; \
- }
-
#include "log.h"