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

@@ -5,9 +5,13 @@
55 #ifdef __APPLE__
66 /* getcontext/makecontext/swapcontext are gated behind _XOPEN_SOURCE on
77 Darwin and marked deprecated since 10.6. _DARWIN_C_SOURCE re-enables
8- Darwin extensions (MAP_ANON, etc.) that _XOPEN_SOURCE alone would hide. */
8+ Darwin extensions (MAP_ANON, etc.) that _XOPEN_SOURCE alone would hide.
9+ Suppress the deprecation warning so -Werror builds pass — we knowingly
10+ use these APIs because Spinel's Fiber implementation depends on them. */
911 #define _XOPEN_SOURCE 600
1012 #define _DARWIN_C_SOURCE
13+#pragma clang diagnostic push
14+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
1115 #endif
1216
1317 #include <stdio.h>
@@ -627,4 +631,8 @@
627631 const char *sp_bigint_to_s(sp_Bigint *b);
628632 void sp_bigint_free(sp_Bigint *b);
629633
634+#ifdef __APPLE__
635+#pragma clang diagnostic pop
636+#endif
637+
630638 #endif /* SP_RUNTIME_H */