Skip to content

Commit 5e6c30e

Browse files
James Chenminggo
James Chen
authored and
minggo
committed
Adds json/document-wrapper.h (#257)
1 parent 0841ee2 commit 5e6c30e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

json/document-wrapper.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
// Wrapper file for document.h to fix the crash bug (https://github.com/cocos2d/cocos2d-x/issues/16492)
4+
5+
// Bug in gcc 4.9.0 on ARM with ARM instruction set, -O2 causes the bug
6+
// This gcc version cannot use #pragma GCC push_options/pop_options as well. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59884
7+
8+
#include "json/rapidjson.h"
9+
10+
#if defined(__arm__) && defined(RAPIDJSON_GNUC) && RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,9,0) && RAPIDJSON_GNUC < RAPIDJSON_VERSION_CODE(5,0,0)
11+
#pragma GCC optimize ("O1")
12+
#endif
13+
#include "document.h"
14+
#if defined(__arm__) && defined(RAPIDJSON_GNUC) && RAPIDJSON_GNUC >= RAPIDJSON_VERSION_CODE(4,9,0) && RAPIDJSON_GNUC < RAPIDJSON_VERSION_CODE(5,0,0)
15+
#pragma GCC reset_options
16+
#endif

0 commit comments

Comments
 (0)