nativejson-benchmark icon indicating copy to clipboard operation
nativejson-benchmark copied to clipboard

gcc6 not happy with #define malloc

Open ir193 opened this issue 8 years ago • 2 comments

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

ir193 avatar Nov 25 '16 23:11 ir193

Would you like to make a pull request?

miloyip avatar Mar 09 '17 01:03 miloyip

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?

jdall avatar Jun 18 '17 00:06 jdall