Files
sx/examples
agra f886d5f1be mem: reject call-conv mismatches at bare-fn → fn-ptr coercion
Passing a default-conv sx function to a `callconv(.c)` fn-pointer slot
(e.g. pthread_create's start routine) used to silently mismatch ABIs:
the C-side caller didn't supply __sx_ctx, so the sx-side body read its
first user param as garbage. The bug surfaced as a SIGSEGV inside
ANativeWindow_setBuffersGeometry on Android during chess bringup.

Now the compiler rejects the coercion outright at the bare-fn name
lookup site:

  error: call-convention mismatch: 'sx_handler' is declared with
  default sx convention but the target type expects callconv(.c)

Also: `#foreign` declarations without an explicit `callconv` now default
to `.c` instead of `.default`. Every external C symbol is by definition
C-conv; the previous default silently typed `objc_msgSend` (et al.) as
default-conv, so the check would fire on the consumer side when the
user typed a fn-ptr as `callconv(.c)`. With the foreign-default fix,
the existing typed-msgSend casts in `std/objc.sx` and `gpu/metal.sx`
keep type-checking and the rule is "C-conv on both sides or neither."

Caught by the new check (fixed in the same commit):
- `ios_gl_proc` in `platform/uikit.sx` lacked callconv(.c) but was
  passed to `load_gl` whose `get_proc` slot expects it.
- `ffi_apply_callback` / `ffi_apply_callback2` in
  `examples/ffi-06-callback.sx` had default-conv fn-ptr params but
  the C bodies (in the companion .c) are unambiguously C-conv.

Regression test: `examples/131-callconv-mismatch-diagnostic.sx`
locks in the diagnostic shape (sx-conv fn → callconv(.c) slot).

153/153 example tests pass. Chess green on macOS / iOS sim / Android.
2026-05-25 09:50:37 +03:00
..
2026-03-06 10:46:28 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-14 13:17:22 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-09 18:07:41 +02:00
2026-02-24 15:10:02 +02:00
2026-02-24 17:37:52 +02:00
2026-02-24 15:10:02 +02:00
2026-02-11 14:22:25 +02:00
2026-02-09 18:07:41 +02:00
2026-02-24 17:37:52 +02:00
2026-02-14 13:17:22 +02:00
2026-02-09 18:07:41 +02:00
...
2026-02-11 13:03:04 +02:00
2026-02-17 16:57:12 +02:00
2026-02-17 16:57:12 +02:00
2026-02-14 14:52:39 +02:00
2026-02-24 17:37:52 +02:00
2026-02-16 01:13:34 +02:00
2026-02-24 06:20:38 +02:00
2026-02-11 01:05:21 +02:00
2026-02-22 22:16:30 +02:00
2026-02-11 20:41:43 +02:00
ir
2026-02-26 02:25:02 +02:00
2026-02-12 12:27:35 +02:00
2026-02-14 13:17:22 +02:00
2026-02-14 14:52:39 +02:00
2026-02-22 22:16:30 +02:00
2026-02-22 17:24:04 +02:00
2026-02-22 17:24:04 +02:00
2026-02-22 17:24:04 +02:00
2026-02-24 17:37:52 +02:00
2026-02-25 15:51:22 +02:00
sm
2026-03-02 21:00:55 +02:00
2026-03-04 17:12:56 +02:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-17 13:19:08 +03:00
2026-05-18 17:40:10 +03:00
2026-05-18 17:40:10 +03:00
2026-05-18 17:40:10 +03:00