Skip to content

Commit 41f2dba

Browse files
committed
P1: fix Zig FFI to compile under Zig 0.14.0
The Zig FFI layer failed to compile under Zig 0.14.0 with four "pointless discard of function parameter" errors in halideiser_execute_pipeline (src/interface/ffi/src/main.zig). The parameters input_ptr, output_ptr, input_len, and output_len are already read by the null-pointer and zero-length validation checks earlier in the function body. Zig 0.14 rejects `_ = param;` discards of parameters that are genuinely used elsewhere, so the four trailing discards were redundant and erroneous. Removed them (replaced with an explanatory comment); the unrelated discards in halideiser_autotune stay, as max_trials/timeout_ms are genuinely unused there. No other errors surfaced once the discards were removed. ABI preserved: every C:<name> in Foreign.idr still maps to an `export fn`, and the Result enum integer values (ok=0 .. dimension_ mismatch=7) are unchanged and continue to match resultToInt in Types.idr. Verification: - zig test src/interface/ffi/src/main.zig -lc -> all 9 tests pass - idris2 --build halideiser-abi.ipkg -> exit 0 Only files under src/interface/ffi/ were changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019xMKB3T4Vo5FYC7Czx3JSH
1 parent 2508b29 commit 41f2dba

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/interface/ffi/src/main.zig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,8 @@ export fn halideiser_execute_pipeline(
424424
// 1. Wrap input_ptr/output_ptr as halide_buffer_t
425425
// 2. Call the compiled pipeline function
426426
// 3. Return the result code
427-
_ = input_ptr;
428-
_ = output_ptr;
429-
_ = input_len;
430-
_ = output_len;
427+
// NB: input_ptr/output_ptr/input_len/output_len are already validated above,
428+
// so they must not be discarded (Zig 0.14 rejects pointless discards).
431429

432430
clearError();
433431
return .ok;

0 commit comments

Comments
 (0)