diff options
author | Chris Robinson <[email protected]> | 2023-03-01 11:35:39 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-03-01 11:35:39 -0800 |
commit | fde74453a62a1ce4b5efaac0ec1835b9f5731e25 (patch) | |
tree | ed74db646800b78ca8651bb5291453927f48cd93 /common/opthelpers.h | |
parent | ec9c421d312d6df701631877f6ce6256355101dc (diff) |
Use macros for the likely/unlikely attributes
The syntax parser for GCC 8 (and earlier?) fails when these attributes are in
certain places.
Diffstat (limited to 'common/opthelpers.h')
-rw-r--r-- | common/opthelpers.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/opthelpers.h b/common/opthelpers.h index 95ff781a..f1d9b74a 100644 --- a/common/opthelpers.h +++ b/common/opthelpers.h @@ -36,6 +36,17 @@ #define ASSUME(x) ((void)0) #endif +/* 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 +#define LIKELY [[likely]] +#define UNLIKELY [[unlikely]] +#endif + namespace al { template<typename T> |