From a021b496cde57e6a2a55b3179e651bef7cba465a Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 5 Jul 2020 05:47:23 -0700 Subject: [PATCH] ircd::json: Use condition around __builtin_assume(). --- ircd/json.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ircd/json.cc b/ircd/json.cc index d33032deb..018aef4f9 100644 --- a/ircd/json.cc +++ b/ircd/json.cc @@ -3414,7 +3414,9 @@ ircd::json::string_stringify(u8x16 &__restrict__ block, default: { assert(block[0] < 0x20); - __builtin_assume(block[0] < 0x20); + #if __has_builtin(__builtin_assume) + __builtin_assume(block[0] < 0x20); + #endif const u8 idx{block[0]}; block = *reinterpret_cast(ctrl_tab + idx); @@ -3631,9 +3633,14 @@ ircd::json::string_serialized(const u8x16 block, { // Covers the ctrl 0x00-0x20 range only; no other character here. default: + { assert(block[0] < 0x20); - __builtin_assume(block[0] < 0x20); + #if __has_builtin(__builtin_assume) + __builtin_assume(block[0] < 0x20); + #endif + return string_serialized_ctrl(block, block_mask, is_ctrl); + } // Unescaped quote: +1 case '"':