Let's hide [[likely]] behind a macro, to suppress warnings if the
compiler doesn't support it.
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
PR preprocessor/103355
libcpp/ChangeLog:
* lex.c: Use ATTR_LIKELY instead of [[likely]].
* system.h (ATTR_LIKELY): Define.
case kind::RTL:
/* These aren't popped by a PDF/PDI. */
break;
- [[likely]] case kind::NONE:
+ ATTR_LIKELY case kind::NONE:
break;
default:
abort ();
#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