miloyip / nativejson-benchmark

C/C++ JSON parser/generator benchmark
MIT License
1.97k stars 262 forks source link

gcc6 not happy with #define malloc #73

Open ir193 opened 7 years ago

ir193 commented 7 years ago

It must be re-define as

define malloc(x) MemoryStatMalloc(x)

However I did not find any official doc about this

http://www.voidcn.com/blog/xiaoyur347/article/p-6005759.html http://stackoverflow.com/questions/1094532/problem-in-overriding-malloc

miloyip commented 7 years ago

Would you like to make a pull request?

jdall commented 7 years ago

After making that change to the code, I get a bunch of issues similar to the following

cc   -MMD -MP -D__STDC_FORMAT_MACROS=1 -DNDEBUG -I../../thirdparty -I../../thirdparty/include -I../../thirdparty/ujson4c/3rdparty -I../../thirdparty/pjson/inc -I../../thirdparty/udp-json-parser -m64 -O3 -Wall -Wextra -march=native -Wall -Wextra  -o "../../intermediate/release_x64/gmake/x64/release/jsonclibs/ujson4c_all.o" -MF "../../intermediate/release_x64/gmake/x64/release/jsonclibs/ujson4c_all.d" -c "../../src/cjsonlibs/ujson4c_all.c"
In file included from ../../src/cjsonlibs/ujson4c_all.c:3:0:
../../thirdparty/ujson4c/src/ujdecode.c: In function ‘alloc’:
../../thirdparty/ujson4c/src/ujdecode.c:144:28: error: ‘struct DecoderState’ has no member named ‘MemoryStatMalloc’
   newSlab = (HeapSlab *) ds->malloc(newSize);

I can fix these issue by #undef'ing the #define malloc/calloc/realloc/free in the individual json lib sources, but then the build fails later on when verifying the libs included in the benchmark.

Has someone fixed this issue?