summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2019-05-21 11:17:39 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2019-05-28 15:18:49 +0200
commit6b8c972acff5f15fd39ff7d96b65048c5a69e834 (patch)
tree1a18d8f24b703e96e5f95b7e94286b68ed1a411e
parenta67fa87f5382e40a08fdcbd4be554bb786c26b32 (diff)
downloadgnutls-6b8c972acff5f15fd39ff7d96b65048c5a69e834.tar.gz
Add nonnull, nonnull_all and warn_unusd_result attributes in lib/gnutls_int.h
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r--lib/gnutls_int.h38
1 files changed, 27 insertions, 11 deletions
diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h
index 0e0942511d..bb49885978 100644
--- a/lib/gnutls_int.h
+++ b/lib/gnutls_int.h
@@ -57,27 +57,43 @@ typedef int ssize_t;
#define ENABLE_ALIGN16
+#ifdef __clang_major
+# define _GNUTLS_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
+#endif
+
+/* clang also defines __GNUC__. It promotes a GCC version of 4.2.1. */
#ifdef __GNUC__
-#ifndef _GNUTLS_GCC_VERSION
-#define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
+# define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
+
#if _GNUTLS_GCC_VERSION >= 30100
-#define likely(x) __builtin_expect((x), 1)
-#define unlikely(x) __builtin_expect((x), 0)
+# define likely(x) __builtin_expect((x), 1)
+# define unlikely(x) __builtin_expect((x), 0)
+#else
+# define likely
+# define unlikely
#endif
-#if _GNUTLS_GCC_VERSION >= 70100
-#define FALLTHROUGH __attribute__ ((fallthrough))
+
+#if _GNUTLS_GCC_VERSION >= 30300
+# define nonnull_all __attribute__ ((nonnull))
+# define nonnull(a) __attribute__ ((nonnull a))
+#else
+# define G_GNUC_WGET_NONNULL_ALL
+# define G_GNUC_WGET_NONNULL(a)
#endif
+
+#if _GNUTLS_GCC_VERSION >= 30400
+# define warn_unused_result __attribute__((warn_unused_result))
+#else
+# define warn_unused_result
#endif
-#ifndef FALLTHROUGH
+#if _GNUTLS_GCC_VERSION >= 70100
+# define FALLTHROUGH __attribute__ ((fallthrough))
+#else
# define FALLTHROUGH
#endif
-#ifndef likely
-#define likely
-#define unlikely
-#endif
/* some systems had problems with long long int, thus,
* it is not used.