diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2018-09-23 17:42:28 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2018-09-23 18:01:58 -0400 |
commit | b192231392e1d63f27880f1de9ef0d82253250a3 (patch) | |
tree | 7ab3d0c623a10803bf84208649a38412ae9ab8e2 /src/first.h | |
parent | 2dbcfc926604df95bb8ba7d6a8cfee96a2fcfefd (diff) | |
download | lighttpd-git-b192231392e1d63f27880f1de9ef0d82253250a3.tar.gz |
[core] log_failed_assert() __attribute__((cold))
Diffstat (limited to 'src/first.h')
-rw-r--r-- | src/first.h | 39 |
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 |