aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcpp/lex.c2
-rw-r--r--libcpp/system.h10
2 files changed, 11 insertions, 1 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 94c36f0..9c27d8b 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1286,7 +1286,7 @@ namespace bidi {
case kind::RTL:
/* These aren't popped by a PDF/PDI. */
break;
- [[likely]] case kind::NONE:
+ ATTR_LIKELY case kind::NONE:
break;
default:
abort ();
diff --git a/libcpp/system.h b/libcpp/system.h
index ee5fbe2..f6fc583 100644
--- a/libcpp/system.h
+++ b/libcpp/system.h
@@ -422,6 +422,16 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
#define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
#endif
+#ifdef __has_cpp_attribute
+# if __has_cpp_attribute(likely)
+# define ATTR_LIKELY [[likely]]
+# elif __has_cpp_attribute(__likely__)
+# define ATTR_LIKELY [[__likely__]]
+# else
+# define ATTR_LIKELY
+# endif
+#endif
+
/* Poison identifiers we do not want to use. */
#if (GCC_VERSION >= 3000)
#undef calloc