summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
Diffstat (limited to 'third_party')
-rw-r--r--third_party/jsoncpp/overrides/src/lib_json/json_value.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp b/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp
index 850724f..a2a4a67 100644
--- a/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp
+++ b/third_party/jsoncpp/overrides/src/lib_json/json_value.cpp
@@ -27,8 +27,14 @@
namespace Json {
// This is a walkaround to avoid the static initialization of Value::null.
-// const Value Value::null;
-static const unsigned char kNull[sizeof(Value)] = { 0 };
+// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of
+// 8 (instead of 4) as a bit of future-proofing.
+#if defined(__ARMEL__)
+#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
+#else
+#define ALIGNAS(byte_alignment)
+#endif
+static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = {0};
const Value& Value::null = reinterpret_cast<const Value&>(kNull);
const Int Value::minInt = Int( ~(UInt(-1)/2) );