From 5aeeffec8063e51f647403b2bbff68bf900b0f9c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 10 Mar 2023 21:03:08 -0800 Subject: Use a macro for when __has_cpp_attribute is unsupported And the standard macro is __has_cpp_attribute, not __has_attribute. --- common/opthelpers.h | 14 ++++++++++---- 1 file 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 { -- cgit v1.2.3