Open lnkuiper opened 1 year ago
Describe the bug I get YYJSON_READ_ERROR_UNEXPECTED_END when reading this (and other JSON):
YYJSON_READ_ERROR_UNEXPECTED_END
{ "firstName": "John", "lastName": "Smith", "isAlive": true, "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100" }, "phoneNumbers": [ { "type": "home", "number": "212 555-1234" }, { "type": "office", "number": "646 555-4567" } ], "children": [], "spouse": null }
Your environment
Additional context I have changed some #defines and found that disabling this piece of code (e.g., by changing 4 to 6 so it is not triggered for GCC 5.4) solves the problem.
#define
/** unlikely for compiler */ #ifndef yyjson_unlikely # if yyjson_has_builtin(__builtin_expect) || YYJSON_GCC_VER >= 4 # define yyjson_unlikely(expr) __builtin_expect(!!(expr), 0) # else # define yyjson_unlikely(expr) (expr) # endif #endif
It seems to work properly in our GCC 4.8 builds though, so maybe it's best to set it to:
YYJSON_GCC_VER >= 4 && YYJSON_GCC_VER != 5
Thanks~ I've made the changes as you suggested, I'll look into the specific reasons later.
Describe the bug I get
YYJSON_READ_ERROR_UNEXPECTED_END
when reading this (and other JSON):Your environment
Additional context I have changed some
#define
s and found that disabling this piece of code (e.g., by changing 4 to 6 so it is not triggered for GCC 5.4) solves the problem.It seems to work properly in our GCC 4.8 builds though, so maybe it's best to set it to: