Skip to content

Commit dfbe1db

Browse files
authored
Merge pull request Tencent#1502 from ylavic/compilation_fixes
Compilation fixes
2 parents eeb9d55 + 92f99bc commit dfbe1db

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

example/sortkeys/sortkeys.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ int main() {
4545
// C++11 supports std::move() of Value so it always have no problem for std::sort().
4646
// Some C++03 implementations of std::sort() requires copy constructor which causes compilation error.
4747
// Needs a sorting function only depends on std::swap() instead.
48-
#if __cplusplus >= 201103L || !defined(__GLIBCXX__)
48+
#if __cplusplus >= 201103L || (!defined(__GLIBCXX__) && (!defined(_MSC_VER) || _MSC_VER >= 1900))
4949
std::sort(d.MemberBegin(), d.MemberEnd(), NameComparator());
50-
#endif
5150

5251
printIt(d);
5352

@@ -59,4 +58,5 @@ int main() {
5958
"zeta": false
6059
}
6160
*/
61+
#endif
6262
}

include/rapidjson/rapidjson.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,8 @@ RAPIDJSON_NAMESPACE_END
631631
#if RAPIDJSON_HAS_CXX11_NOEXCEPT
632632
#define RAPIDJSON_NOEXCEPT_ASSERT(x)
633633
#else
634-
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)
634+
#include <cassert>
635+
#define RAPIDJSON_NOEXCEPT_ASSERT(x) assert(x)
635636
#endif // RAPIDJSON_HAS_CXX11_NOEXCEPT
636637
#else
637638
#define RAPIDJSON_NOEXCEPT_ASSERT(x) RAPIDJSON_ASSERT(x)

test/unittest/unittest.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ class AssertException : public std::logic_error {
122122

123123
#ifndef RAPIDJSON_ASSERT
124124
#define RAPIDJSON_ASSERT(x) (!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u)
125+
#ifndef RAPIDJSON_ASSERT_THROWS
126+
#define RAPIDJSON_ASSERT_THROWS
127+
#endif
125128
#endif
126129

127130
class Random {

0 commit comments

Comments
 (0)