ibireme / yyjson

The fastest JSON library in C
https://ibireme.github.io/yyjson/doc/doxygen/html/
MIT License
3.04k stars 262 forks source link

fix: qnx system compile error #96

Closed Guanngxu closed 1 year ago

Guanngxu commented 1 year ago

because of __asm volatile("":"=m"(*src)::);, yyjson can't compile successfully in QNX system.

codecov[bot] commented 1 year ago

Codecov Report

Merging #96 (f612c05) into master (b2a6dfe) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #96   +/-   ##
=======================================
  Coverage   98.41%   98.41%           
=======================================
  Files           2        2           
  Lines        2335     2335           
=======================================
  Hits         2298     2298           
  Misses         37       37           
Impacted Files Coverage Δ
src/yyjson.h 87.05% <ø> (ø)
src/yyjson.c 98.84% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

ibireme commented 1 year ago

What compiler are you using? If the compiler defines __GNUC__ but does not support the GCC inline assembler, then we can exclude it here (without an additional CMake option): https://github.com/ibireme/yyjson/blob/master/src/yyjson.c#L76-L82

Guanngxu commented 1 year ago

What compiler are you using? If the compiler defines __GNUC__ but does not support the GCC inline assembler, then we can exclude it here (without an additional CMake option): https://github.com/ibireme/yyjson/blob/master/src/yyjson.c#L76-L82

I tried https://github.com/ibireme/yyjson/blob/master/src/yyjson.c#L76-L82 but it doesn't work well. My gcc version is 4.4.2, and my system version is QNX 6.5.0

ibireme commented 1 year ago

@Guanngxu Can you list your compiler's predefined macros and post the results here?

gcc -dM -E -x c /dev/null

Maybe we can find a unique macro to identify that platform.

ibireme commented 1 year ago

I tried qnxsdp-6.5.0, and it looks like an earlier version of GCC does not support empty optional extended asm label.

I made a fix: https://github.com/ibireme/yyjson/commit/586e7c7c327007c355abc7fc5b1e8767836f5f26

Guanngxu commented 1 year ago

I tried qnxsdp-6.5.0, and it looks like an earlier version of GCC does not support empty optional extended asm label.

I made a fix: 586e7c7

OK,thank you!