wcc/ww: serialize aggregate exported defs as value-less .wwi prototypes (BUG-2, #70)
The .wwi (separate-compile interface) producer could not serialize an
exported def whose initializer is a struct/array literal (N_STRUCTLIT/
N_ARRLIT) — `export def f64info: floatinfo = floatinfo{...}` aborted with
"unhandled const-expr node kind 15". Such a def is a DATA-global per the
#52 model, so its value lives once in the defining package's .o; the
interface needs only the type+symbol. Emit a value-less prototype
`export def X: T;` for aggregate-initializer defs; scalar fold-eligible
defs keep their value (the importer const-folds those). The parser gains
an optional-init arm so the importer can parse the prototype — value-less
`def X: T;` is now legal in any source, symmetric with the existing
bodyless-fn prototype `fn f();` (USER ruling: unconditional; a value-less
def with no defining .o is a loud undefined-symbol error at link, never
silent). Both stages; producer + parser fold into one commit (the
producer's output is unparseable without the parser arm).
M3-tail commit-6 prerequisite #2 (surfaced by the c6 scout). The
aggregate-def-field const-fold boundary is documented inline (#71). Gate
989_sepstructdef_run proves struct+array exported defs sep-build, link,
and run via external DATA refs, cs==ww, with a value-less .wwi.
This commit is contained in:
12
Makefile
12
Makefile
@@ -566,6 +566,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_sepbuild_run \
|
||||
$(BIN)/test_sepdotpath_run \
|
||||
$(BIN)/test_seproot_export_run \
|
||||
$(BIN)/test_sepstructdef_run \
|
||||
$(BIN)/test_sepcycle_dup \
|
||||
$(BIN)/test_separchive_run \
|
||||
$(BIN)/test_pkgcache_run \
|
||||
@@ -3134,6 +3135,17 @@ $(BIN)/test_seproot_export_run: test/wcc/989_seproot_export_run.c $(BIN)/ww $(BI
|
||||
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# 989_sepstructdef_run — sep-build of a dep exporting aggregate-initializer
|
||||
# defs (N_STRUCTLIT info / N_ARRLIT arr) (#70, BUG-2): the producer must emit a
|
||||
# value-LESS prototype `export def X: T;` for an aggregate-init def (DATA-global
|
||||
# per #52), and the def parser must accept that bodyless form. Drives BOTH
|
||||
# driver stages + reads back the dep `.wwi`, so it needs both driver + both
|
||||
# compiler + both linker stages + libwwrt for the link.
|
||||
$(BIN)/test_sepstructdef_run: test/wcc/989_sepstructdef_run.c $(BIN)/ww $(BIN)/ww_ww \
|
||||
$(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6a_ww \
|
||||
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# 989_sepcycle_dup — M3-tail commit-4 negative gates (#46, #31): a loud
|
||||
# dep-cycle reject (both driver stages, cs==ww stderr) + the #31
|
||||
# duplicate-symbol reject (both linker stages). Needs both driver stages,
|
||||
|
||||
Reference in New Issue
Block a user