]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Add nonnull, nonnull_all and warn_unusd_result attributes in lib/gnutls_int.h
authorTim Rühsen <tim.ruehsen@gmx.de>
Tue, 21 May 2019 09:17:39 +0000 (11:17 +0200)
committerTim Rühsen <tim.ruehsen@gmx.de>
Tue, 28 May 2019 13:18:49 +0000 (15:18 +0200)
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
lib/gnutls_int.h

index 0e0942511dedb4edab6f114baef1744f55cb1769..bb4988597855d933d2d65e9453c6965203409b09 100644 (file)
@@ -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.