summaryrefslogtreecommitdiff
path: root/shared/utils.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-24 01:39:32 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-24 01:39:32 +0200
commit02afe960644466b8e3854f3bec48c03a294c1e35 (patch)
treea964e96959e4436d0253d9b574c198a66a398bbe /shared/utils.h
parentc43719d6ba9c7d3395af1f15c74882bdf26cdc86 (diff)
Add some more annotations
Diffstat (limited to 'shared/utils.h')
-rw-r--r--shared/utils.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/shared/utils.h b/shared/utils.h
index 3ad603b..0fc1429 100644
--- a/shared/utils.h
+++ b/shared/utils.h
@@ -12,21 +12,31 @@
extern unsigned debug_mask;
-#include "list.h"
-#include "debug.h"
+#define _unused_ __attribute__((__unused__))
+
+#define _printf_(a, b) __attribute__((__format__(printf, a, b)))
-/* These functions need to be defined in the linking binary */
-#define zmalloc(s) __zmalloc(__func__, __LINE__, s)
-void *__zmalloc(const char *fn, int line, size_t s);
+#define _alignas_(x) __attribute__((__aligned__(__alignof(x))))
-#define xstrdup(s) __xstrdup(__func__, __LINE__, s)
-char *__xstrdup(const char *fn, int line, const char *s);
+#define _big_endian_ __attribute__((packed, scalar_storage_order("big-endian")))
-#define xstrndup(s, n) __xstrndup(__func__, __LINE__, s, n)
-char *__xstrndup(const char *fn, int line, const char *s, size_t n);
+#if __GNUC__ >= 7
+#define _fallthrough_ __attribute__((__fallthrough__))
+#else
+#define _fallthrough_
+#endif
-#define xfree(s) __xfree(__func__, __LINE__, s)
-void __xfree(const char *fn, int line, void *ptr);
+#ifndef _noreturn_
+#if __STDC_VERSION__ >= 201112L
+#define _noreturn_ _Noreturn
+#else
+#define _noreturn_ __attribute__((__noreturn__))
+#endif
+#endif
+
+#include "list.h"
+#include "debug.h"
+#include "external.h"
/* Length of longest DNS name = 253 + trailing dot */
#define FQDN_STR_LEN 254