summaryrefslogtreecommitdiff
path: root/src/first.h
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2018-09-23 17:42:28 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2018-09-23 18:01:58 -0400
commitb192231392e1d63f27880f1de9ef0d82253250a3 (patch)
tree7ab3d0c623a10803bf84208649a38412ae9ab8e2 /src/first.h
parent2dbcfc926604df95bb8ba7d6a8cfee96a2fcfefd (diff)
downloadlighttpd-git-b192231392e1d63f27880f1de9ef0d82253250a3.tar.gz
[core] log_failed_assert() __attribute__((cold))
Diffstat (limited to 'src/first.h')
-rw-r--r--src/first.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/first.h b/src/first.h
index 33e52cb7..38c25929 100644
--- a/src/first.h
+++ b/src/first.h
@@ -55,4 +55,43 @@
#define UNUSED(x) ( (void)(x) )
+
+#ifndef __has_attribute /* clang */
+#define __has_attribute(x) 0
+#endif
+
+#ifdef __GNUC__
+#ifndef __GNUC_PREREQ
+# ifdef __GNUC_PREREQ__
+# define __GNUC_PREREQ __GNUC_PREREQ__
+# elif defined __GNUC__ && defined __GNUC_MINOR__
+# define __GNUC_PREREQ(maj, min) \
+ ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+# else
+# define __GNUC_PREREQ(maj, min) 0
+# endif
+#endif
+#else
+#define __GNUC_PREREQ(maj,min) 0
+#endif
+
+#ifndef __attribute_cold__
+#if __has_attribute(cold) \
+ || __GNUC_PREREQ(4,3)
+#define __attribute_cold__ __attribute__((__cold__))
+#else
+#define __attribute_cold__
+#endif
+#endif
+
+#ifndef __attribute_noreturn__
+#if __has_attribute(noreturn) \
+ || __GNUC_PREREQ(2,5)
+#define __attribute_noreturn__ __attribute__((__noreturn__))
+#else
+#define __attribute_noreturn__
+#endif
+#endif
+
+
#endif