How to fix compilation error on MacOS with Xcode version 14.4 and later
The latest version of Xcode (14.4 or higher) gave an error introduced by a clang specific change in cdefs.h on compilation. The error message is:
Compiling src/common.c
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:62,
from src/common.c:38:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:554:30: error: missing ')' after "__has_attribute"
554 | #if __has_cpp_attribute(clang::unsafe_buffer_usage)
| ^
compilation terminated due to -Wfatal-errors.
A fix (code hack) is suggested on the Apple Developers Forum: https://forums.developer.apple.com/forums/thread/747762
I replaced cdefs.h with a modified version following the above code hack and that worked.