GitHub CI: update list of container images
[tinc] / src / have.h
index 1d1bedf..a155b04 100644 (file)
@@ -29,6 +29,8 @@
 #define _CRT_NONSTDC_NO_WARNINGS
 #endif
 
+#define __STDC_WANT_LIB_EXT1__ 1
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #endif
 #endif
 
+#if defined(HAVE_ATTR_MALLOC_WITH_ARG)
+#define ATTR_DEALLOCATOR(dealloc) __attribute__((__malloc__(dealloc)))
+#else
+#define ATTR_DEALLOCATOR(dealloc)
+#endif
+
+#ifdef HAVE_ATTR_MALLOC
+#define ATTR_MALLOC __attribute__((__malloc__))
+#else
+#define ATTR_MALLOC
+#endif
+
+#ifdef HAVE_ATTR_NONNULL
+#define ATTR_NONNULL __attribute__((__nonnull__))
+#else
+#define ATTR_NONNULL
+#endif
+
+#ifdef HAVE_ATTR_WARN_UNUSED_RESULT
+#define ATTR_WARN_UNUSED __attribute__((__warn_unused_result__))
+#else
+#define ATTR_WARN_UNUSED
+#endif
+
+#ifdef HAVE_ATTR_FORMAT
+#define ATTR_FORMAT(func, str, nonstr) __attribute__((format(func, str, nonstr)))
+#else
+#define ATTR_FORMAT(func, str, nonstr)
+#endif
+
 #ifdef HAVE_ALLOCA_H
 #include <alloca.h>
 #elif defined(HAVE_NETBSD)
 #include <syslog.h>
 #endif
 
+#ifdef HAVE_SYS_RANDOM_H
+#include <sys/random.h>
+#endif
+
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
 
-
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif