diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/opthelpers.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/common/opthelpers.h b/common/opthelpers.h index f1d9b74a..596c2455 100644 --- a/common/opthelpers.h +++ b/common/opthelpers.h @@ -11,6 +11,12 @@ #define HAS_BUILTIN(x) (0) #endif +#ifdef __has_cpp_attribute +#define HAS_ATTRIBUTE __has_cpp_attribute +#else +#define HAS_ATTRIBUTE(x) (0) +#endif + #ifdef __GNUC__ #define force_inline [[gnu::always_inline]] inline #elif defined(_MSC_VER) @@ -39,12 +45,12 @@ /* This shouldn't be needed since unknown attributes are ignored, but older * versions of GCC choke on the attribute syntax in certain situations. */ -#if !__has_attribute(likely) -#define LIKELY -#define UNLIKELY -#else +#if HAS_ATTRIBUTE(likely) #define LIKELY [[likely]] #define UNLIKELY [[unlikely]] +#else +#define LIKELY +#define UNLIKELY #endif namespace al { |