summaryrefslogtreecommitdiff
path: root/ext/json/parser
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-11-04 12:06:46 +0100
committergit <svn-admin@ruby-lang.org>2025-11-04 11:07:31 +0000
commitf1776e8f176f50bd9ab16ca399d1a9c8b7d6eeb7 (patch)
tree1d1d785224410b7cc18d22061b9ff7b1996d05d5 /ext/json/parser
parent7c924013630699321d51438f3754b291d8d4a37e (diff)
[ruby/json] Tentative fix for RHEL8 compiler
``` parser.c:87:77: error: missing binary operator before token "(" #if JSON_CPU_LITTLE_ENDIAN_64BITS && defined(__has_builtin) && __has_builtin(__builtin_bswap64) ``` https://github.com/ruby/json/commit/fce1c7e84a
Diffstat (limited to 'ext/json/parser')
-rw-r--r--ext/json/parser/parser.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c
index 3d88a399e7..9df04ce007 100644
--- a/ext/json/parser/parser.c
+++ b/ext/json/parser/parser.c
@@ -84,7 +84,11 @@ static void rvalue_cache_insert_at(rvalue_cache *cache, int index, VALUE rstring
cache->entries[index] = rstring;
}
-#if JSON_CPU_LITTLE_ENDIAN_64BITS && defined(__has_builtin) && __has_builtin(__builtin_bswap64)
+#define rstring_cache_memcmp memcmp
+
+#if JSON_CPU_LITTLE_ENDIAN_64BITS
+#if __has_builtin(__builtin_bswap64)
+#undef rstring_cache_memcmp
static ALWAYS_INLINE() int rstring_cache_memcmp(const char *str, const char *rptr, const long length)
{
// The libc memcmp has numerous complex optimizations, but in this particular case,
@@ -111,8 +115,7 @@ static ALWAYS_INLINE() int rstring_cache_memcmp(const char *str, const char *rpt
return 0;
}
-#else
-#define rstring_cache_memcmp memcmp
+#endif
#endif
static ALWAYS_INLINE() int rstring_cache_cmp(const char *str, const long length, VALUE rstring)