Commit f3dea95f
f3dea95f26abMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
fix(macos): suppress deprecation warning for ucontext APIs
On macOS, getcontext/makecontext/swapcontext are marked deprecated since 10.6. With -Werror in the test/bench Makefile rules, this turns the warning into a hard build failure and every test/bench errors out on Apple platforms. Reported in #6.
Wrap the runtime header in #pragma clang diagnostic push/pop guarded by APPLE, ignoring -Wdeprecated-declarations only for translation units that include sp_runtime.h. Linux is unaffected.
The Fiber implementation knowingly relies on these APIs; if they ever get removed from libSystem we will need a replacement, but until then the warning has no actionable signal.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- f3dea95f26ab
- Parent
- 9734756db8fd
lib/sp_runtime.hmodifiedView file
#ifdef __APPLE__/* getcontext/makecontext/swapcontext are gated behind _XOPEN_SOURCE on Darwin and marked deprecated since 10.6. _DARWIN_C_SOURCE re-enables Darwin extensions (MAP_ANON, etc.) that _XOPEN_SOURCE alone would hide. */ Darwin extensions (MAP_ANON, etc.) that _XOPEN_SOURCE alone would hide. Suppress the deprecation warning so -Werror builds pass — we knowingly use these APIs because Spinel's Fiber implementation depends on them. */#define _XOPEN_SOURCE 600#define _DARWIN_C_SOURCE#pragma clang diagnostic push#pragma clang diagnostic ignored "-Wdeprecated-declarations"#endif#include <stdio.h>const char *sp_bigint_to_s(sp_Bigint *b);void sp_bigint_free(sp_Bigint *b);#ifdef __APPLE__#pragma clang diagnostic pop#endif#endif /* SP_RUNTIME_H */