summaryrefslogtreecommitdiff
path: root/upb
diff options
context:
space:
mode:
authorEsun Kim <veblush@google.com>2019-08-09 08:39:04 -0700
committerEsun Kim <veblush@google.com>2019-08-09 08:39:04 -0700
commitbc6d9518e10bceb07ea128dc7b83decee2f082c7 (patch)
tree06d0cc012d11da10367afa04351af603f6e47df3 /upb
parentb70f68269a7d51c5ce372a93742bf6960215ffef (diff)
Make it use builtin functions on clang
Diffstat (limited to 'upb')
-rw-r--r--upb/port_def.inc6
1 files changed, 3 insertions, 3 deletions
diff --git a/upb/port_def.inc b/upb/port_def.inc
index 3e0a7f4..1b7c335 100644
--- a/upb/port_def.inc
+++ b/upb/port_def.inc
@@ -45,14 +45,14 @@
/* UPB_INLINE: inline if possible, emit standalone code if required. */
#ifdef __cplusplus
#define UPB_INLINE inline
-#elif defined (__GNUC__)
+#elif defined (__GNUC__) || defined(__clang__)
#define UPB_INLINE static __inline__
#else
#define UPB_INLINE static
#endif
/* Hints to the compiler about likely/unlikely branches. */
-#ifdef __GNUC__
+#if defined (__GNUC__) || defined(__clang__)
#define UPB_LIKELY(x) __builtin_expect((x),1)
#define UPB_UNLIKELY(x) __builtin_expect((x),0)
#else
@@ -139,7 +139,7 @@ int msvc_snprintf(char* s, size_t n, const char* format, ...);
* exist in debug mode. This turns into regular assert. */
#define UPB_ASSERT_DEBUGVAR(expr) assert(expr)
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
#define UPB_UNREACHABLE() do { assert(0); __builtin_unreachable(); } while(0)
#else
#define UPB_UNREACHABLE() do { assert(0); } while(0)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback