Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Milette <me@charlesmilette.net>2019-07-25 23:55:34 +0300
committerCharles Milette <me@charlesmilette.net>2019-07-25 23:55:34 +0300
commit07e1d7870ac4a1b5dbdeca69301aeea2efc5a5fd (patch)
treedc683121e83e55582823c22ba5924eedac2e7d24
parentd5d7171f6d21f2894e67bbe47c9a48e01114700f (diff)
Fix build error under non-Clang compilers
-rw-r--r--include/rapidjson/internal/clzll.h2
-rw-r--r--include/rapidjson/rapidjson.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/include/rapidjson/internal/clzll.h b/include/rapidjson/internal/clzll.h
index 7c2fa48f..3449038b 100644
--- a/include/rapidjson/internal/clzll.h
+++ b/include/rapidjson/internal/clzll.h
@@ -29,7 +29,7 @@
RAPIDJSON_NAMESPACE_BEGIN
namespace internal {
-#if defined(__has_builtin) && __has_builtin(__builtin_clzll)
+#if (defined(__GNUC__) && __GNUC__ >= 4) || RAPIDJSON_HAS_BUILTIN(__builtin_clzll)
#define RAPIDJSON_CLZLL __builtin_clzll
#else
diff --git a/include/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h
index 549936ff..62b079f2 100644
--- a/include/rapidjson/rapidjson.h
+++ b/include/rapidjson/rapidjson.h
@@ -490,6 +490,12 @@ RAPIDJSON_NAMESPACE_END
#define RAPIDJSON_VERSION_CODE(x,y,z) \
(((x)*100000) + ((y)*100) + (z))
+#if defined(__has_builtin)
+#define RAPIDJSON_HAS_BUILTIN(x) __has_builtin(x)
+#else
+#define RAPIDJSON_HAS_BUILTIN(x) 0
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_DIAG_PUSH/POP, RAPIDJSON_DIAG_OFF