From c3f994822d4950104c5382f2a4acd8b179af5034 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sat, 16 May 2026 00:03:19 +0900 Subject: [PATCH] lib/fmt+lib/log+lib/memio: drop rt_syscall stubs in tests; use os MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After 12436dd, lib/fmt and lib/log production code routed through os.write / os.exit. The test files (fmttest, logtest, memiotest) still carried the same @symbol("rt_syscall") syscall1ww / doexit stub block with the (now stale) os↔io collision rationale. Same mechanical drop as 12436dd: add use os;, route fail() through os.exit, remove the stubs. Also reword the stale workaround comment in lib/memio/memio.ww covering rt_alloc/rt_free. The decls themselves stay until lib/os exports alloc/free as a follow-up. No combined.ww regen (these files aren't bootstrap-folded). --- lib/fmt/fmttest.ww | 11 ++--------- lib/log/logtest.ww | 12 ++---------- lib/memio/memio.ww | 6 +++--- lib/memio/memiotest.ww | 11 ++--------- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/lib/fmt/fmttest.ww b/lib/fmt/fmttest.ww index 08ccfd88..0eea56b1 100644 --- a/lib/fmt/fmttest.ww +++ b/lib/fmt/fmttest.ww @@ -10,20 +10,13 @@ use fmt; use io; use memio; - -// Direct exit(2) binding rather than `use os;` — os exports -// read/write/close, which collide with io.read/write/close under -// the driver's flat-scope concat. -@symbol("rt_syscall") fn syscall1ww(num: i64, a: i64) i64; -fn doexit(code: i32) void = { - syscall1ww(60i64, code: i64); -}; +use os; // signalled — bumped before each scenario so a failing exit code // pinpoints the offending case. let signalled: i32 = 0; -fn fail() void = { doexit(signalled + 10); }; +fn fail() void = { os.exit(signalled + 10); }; fn streq(a: str, b: str) bool = { if (a.len != b.len) { return false; }; diff --git a/lib/log/logtest.ww b/lib/log/logtest.ww index 6bd9efa7..e5caeede 100644 --- a/lib/log/logtest.ww +++ b/lib/log/logtest.ww @@ -13,21 +13,13 @@ use fmt; use io; use log; use memio; - -// Direct exit(2) binding rather than `use os;` — os exports -// read/write/close, which collide with io.read/write/close under -// the driver's flat-scope concat. Same workaround as bufiotest / -// fmttest / memiotest. -@symbol("rt_syscall") fn syscall1ww(num: i64, a: i64) i64; -fn doexit(code: i32) void = { - syscall1ww(60i64, code: i64); -}; +use os; // signalled — bumped before each scenario so a failing exit code // pinpoints the offending case. let signalled: i32 = 0; -fn fail() void = { doexit(signalled + 10); }; +fn fail() void = { os.exit(signalled + 10); }; fn streq(a: str, b: str) bool = { if (a.len != b.len) { return false; }; diff --git a/lib/memio/memio.ww b/lib/memio/memio.ww index 2ed5fb3e..753f81aa 100644 --- a/lib/memio/memio.ww +++ b/lib/memio/memio.ww @@ -28,9 +28,9 @@ use io; -// Direct rt_alloc/rt_free bindings rather than `use os;` because os -// exports read/write/close, which collide with io.read/write/close -// under the driver's flat-scope concatenation. Same pattern as +// Direct rt_alloc/rt_free bindings — the runtime heap primitives +// memio.dynamic / dynamicfrom need to own the backing buffer. lib/os +// holds the same FFI shape but doesn't export it; same pattern as // rt/ensure.ww. @symbol("rt_alloc") fn rtalloc(n: u64) *void; @symbol("rt_free") fn rtfree(p: *void, n: u64) void; diff --git a/lib/memio/memiotest.ww b/lib/memio/memiotest.ww index 34dbcab1..228fe003 100644 --- a/lib/memio/memiotest.ww +++ b/lib/memio/memiotest.ww @@ -8,20 +8,13 @@ use bytes; use io; use memio; - -// Direct exit(2) binding rather than `use os;` — os exports -// read/write/close, which collide with io.read/write/close under -// the driver's flat-scope concat (task #7). -@symbol("rt_syscall") fn syscall1ww(num: i64, a: i64) i64; -fn doexit(code: i32) void = { - syscall1ww(60i64, code: i64); -}; +use os; // signalled — bumped by main before each test so a failing exit code // pinpoints the offending case. let signalled: i32 = 0; -fn fail() void = { doexit(signalled + 10); }; +fn fail() void = { os.exit(signalled + 10); }; fn putstr(s: str, into: []u8, off: i32) i32 = { let i: i32 = 0;