From 02afe960644466b8e3854f3bec48c03a294c1e35 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Wed, 24 Jun 2020 01:39:32 +0200 Subject: Add some more annotations --- shared/utils.h | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'shared/utils.h') 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 -- cgit v1.2.3