check: gate C-style ... to bodiless decls, both stages (#11)

A bodied fn with a bare C-style `...` was silently accepted by cstage
and SEGFAULTED wwstage (resolvefnbody walked a typeless `...` param).
Gate it: bare C-`...` is allowed only on bodiless decls (extern /
@symbol prototypes), the real FFI path; Hare-style `T...` is unaffected.

ww restricts C-`...` to bodiless decls pending vastart/vaarg/vaend
builtins (#16); harec permits bodied C-variadic fns (check.c:3656) -- a
documented divergence, reopened when #16 lands.

Test 852 runs both stages; its reject rows require the gate's diagnostic
(not merely a nonzero exit), so a crash can't pass them vacuously.
This commit is contained in:
2026-06-21 12:14:31 +09:00
parent c814856550
commit 1f1efb273a
4 changed files with 263 additions and 0 deletions

View File

@@ -249,6 +249,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_const_reassign_reject \
$(BIN)/test_dupfield_reject \
$(BIN)/test_enum_reject \
$(BIN)/test_variadic_body_reject \
$(BIN)/test_index_int_reject \
$(BIN)/test_size_untyped_int \
$(BIN)/test_tagged_staticinit \
@@ -1581,6 +1582,12 @@ $(BIN)/test_enum_reject: test/wcc/850_enum_reject.c $(BIN)/ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_variadic_body_reject: test/wcc/852_variadic_body_reject.c $(BIN)/ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_index_int_reject: test/wcc/851_index_int_reject.c $(BIN)/ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \