From 2cce6a3a2619e0690a31159ae9cf0108f5203602 Mon Sep 17 00:00:00 2001 From: agra Date: Mon, 15 Jun 2026 07:28:20 +0300 Subject: [PATCH] =?UTF-8?q?refactor(ffi-linkage):=20Phase=208=20pre-cutove?= =?UTF-8?q?r=20=E2=80=94=20migrate=20identity=20ffi-foreign-*=20test=20dec?= =?UTF-8?q?ls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrate the DECLS of the 7 identity-#foreign feature tests to extern/export (1205-global/-helper, 1207, 1218-cvariadic, 1219, 1306, 1318): fn/global markers → extern, the 2 objc import classes (1306/1318) → postfix '#objc_class("X") extern {'. Behavior-preserving (A→B gate + existing extern twins guarantee identical output); empty snapshot diff, corpus-validated. Comment-only #foreign in these files is left for the Phase 9.3 doc/comment purge (comments aren't parsed → not cutover-critical). Suite green (647 corpus / 444 unit, 0 failed). --- examples/1205-ffi-foreign-global-helper.sx | 2 +- examples/1205-ffi-foreign-global.sx | 2 +- examples/1207-ffi-foreign-global-from-helper.sx | 2 +- examples/1218-ffi-foreign-cvariadic.sx | 6 +++--- examples/1219-ffi-foreign.sx | 2 +- examples/1306-ffi-objc-foreign-class-chained-dispatch.sx | 4 ++-- examples/1318-ffi-objc-property-foreign.sx | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/1205-ffi-foreign-global-helper.sx b/examples/1205-ffi-foreign-global-helper.sx index 7f5e701..dfee33c 100644 --- a/examples/1205-ffi-foreign-global-helper.sx +++ b/examples/1205-ffi-foreign-global-helper.sx @@ -6,7 +6,7 @@ // this file participates in the link and the cross-file decl // coexistence is exercised. -__stdinp : *void #foreign; +__stdinp : *void extern; stdinp_addr_present :: () -> i32 { 1 diff --git a/examples/1205-ffi-foreign-global.sx b/examples/1205-ffi-foreign-global.sx index 0eef143..347ce5f 100644 --- a/examples/1205-ffi-foreign-global.sx +++ b/examples/1205-ffi-foreign-global.sx @@ -17,7 +17,7 @@ #import "modules/std.sx"; #import "1205-ffi-foreign-global-helper.sx"; -__stdinp : *void #foreign; +__stdinp : *void extern; main :: () -> i32 { addr_bits : u64 = xx @__stdinp; diff --git a/examples/1207-ffi-foreign-global-from-helper.sx b/examples/1207-ffi-foreign-global-from-helper.sx index 11d09ee..291f997 100644 --- a/examples/1207-ffi-foreign-global-from-helper.sx +++ b/examples/1207-ffi-foreign-global-from-helper.sx @@ -12,7 +12,7 @@ #import "modules/std.sx"; -__stdinp : *void #foreign; +__stdinp : *void extern; stdinp_addr_via_helper :: () -> u64 { xx @__stdinp diff --git a/examples/1218-ffi-foreign-cvariadic.sx b/examples/1218-ffi-foreign-cvariadic.sx index 4db540b..b2aded6 100644 --- a/examples/1218-ffi-foreign-cvariadic.sx +++ b/examples/1218-ffi-foreign-cvariadic.sx @@ -9,9 +9,9 @@ #source "1218-ffi-foreign-cvariadic.c"; }; -sx_ffi_sum_ints :: (n: i32, ..args: []i32) -> i64 #foreign; -sx_ffi_avg_doubles :: (n: i32, ..args: []f64) -> f64 #foreign; -sx_ffi_count_args :: (tag: *u8, ..args: []*u8) -> i32 #foreign; +sx_ffi_sum_ints :: (n: i32, ..args: []i32) -> i64 extern; +sx_ffi_avg_doubles :: (n: i32, ..args: []f64) -> f64 extern; +sx_ffi_count_args :: (tag: *u8, ..args: []*u8) -> i32 extern; main :: () -> i32 { print("sum_ints(3, 10, 20, 30) = {}\n", sx_ffi_sum_ints(3, 10, 20, 30)); diff --git a/examples/1219-ffi-foreign.sx b/examples/1219-ffi-foreign.sx index cf1b4e2..32e284a 100644 --- a/examples/1219-ffi-foreign.sx +++ b/examples/1219-ffi-foreign.sx @@ -7,7 +7,7 @@ pkg :: #import "tests/fixtures/testpkg"; // --- Foreign function binding --- libc :: #library "c"; -c_abs :: (n: i32) -> i32 #foreign libc "abs"; +c_abs :: (n: i32) -> i32 extern libc "abs"; // --- Protocol declarations (Phase 1: static dispatch only) --- diff --git a/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx b/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx index 82e1424..62434c8 100644 --- a/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx +++ b/examples/1306-ffi-objc-foreign-class-chained-dispatch.sx @@ -12,12 +12,12 @@ #import "modules/std.sx"; #import "modules/build.sx"; -NSObject :: #foreign #objc_class("NSObject") { +NSObject :: #objc_class("NSObject") extern { alloc :: () -> *NSObject; init :: (self: *Self) -> *Self; } -NSObjectSelfReturn :: #foreign #objc_class("NSObject") { +NSObjectSelfReturn :: #objc_class("NSObject") extern { alloc :: () -> *Self; init :: (self: *Self) -> *Self; } diff --git a/examples/1318-ffi-objc-property-foreign.sx b/examples/1318-ffi-objc-property-foreign.sx index dd58ee1..0f9a4ec 100644 --- a/examples/1318-ffi-objc-property-foreign.sx +++ b/examples/1318-ffi-objc-property-foreign.sx @@ -31,7 +31,7 @@ probe_set_tag :: (self: *void, _cmd: *void, v: i32) callconv(.c) { } // Foreign declaration with #property on `tag`. -SxPropProbe :: #foreign #objc_class("SxPropProbe") { +SxPropProbe :: #objc_class("SxPropProbe") extern { alloc :: () -> *SxPropProbe; init :: (self: *SxPropProbe) -> *SxPropProbe; tag: i32 #property;