Skip to content

Commit 07e1d78

Browse files
committed
Fix build error under non-Clang compilers
1 parent d5d7171 commit 07e1d78

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/rapidjson/internal/clzll.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
RAPIDJSON_NAMESPACE_BEGIN
3030
namespace internal {
3131

32-
#if defined(__has_builtin) && __has_builtin(__builtin_clzll)
32+
#if (defined(__GNUC__) && __GNUC__ >= 4) || RAPIDJSON_HAS_BUILTIN(__builtin_clzll)
3333
#define RAPIDJSON_CLZLL __builtin_clzll
3434
#else
3535

include/rapidjson/rapidjson.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,12 @@ RAPIDJSON_NAMESPACE_END
490490
#define RAPIDJSON_VERSION_CODE(x,y,z) \
491491
(((x)*100000) + ((y)*100) + (z))
492492

493+
#if defined(__has_builtin)
494+
#define RAPIDJSON_HAS_BUILTIN(x) __has_builtin(x)
495+
#else
496+
#define RAPIDJSON_HAS_BUILTIN(x) 0
497+
#endif
498+
493499
///////////////////////////////////////////////////////////////////////////////
494500
// RAPIDJSON_DIAG_PUSH/POP, RAPIDJSON_DIAG_OFF
495501

0 commit comments

Comments
 (0)