rm dead combined.ww + retarget 901 to sep-feed; sweep amalgamator remnants (M4 E4, #90)
The E3 flip (#87) made sep the sole compile path and deleted the
combined.ww writer, leaving the six committed *.combined.ww files dead.
Remove them and the last references to the retired amalgamator.
- rm the 6 tracked *.combined.ww (selfhost/cmd/{w6a,w6c,w6l,ww,wwdump}/
main.combined.ww + selfhost/test/smoke.combined.ww). Verified no live
build path or gate still feeds one as compiler INPUT.
- 901_asserttyped_gap: its 5 combined.ww gap fixtures were the last
combined.ww INPUT consumers (4 already missing/vacuous post-flip, only
smoke.combined.ww still fed). Retarget all 5 to sep-feed via a
resolveunit helper (whole-package-dir copy -> `ww build --sep` ->
<stem>.sepwork/__root.unit.ww), mirroring 990's #89 pattern; the 3
import-free test fixtures stay raw-fed. All 8 counts hold at 0 (A-D
coverage, vacuous since the flip, is live again).
- INV-2 (the driver's unresolvable-import-is-fatal guard) is KEPT; only
its "Mirrors the deleted expand" lineage tail is swept. The #110
combined_ww_fresh freshness gate was already removed in #89 (5f85852).
- Sweep dangling amalgamator lineage comments (build_one/buildone/expand/
peek_package/peekpackage + stale combined.ww/combined intermediates)
in cmd/ww/main.c + selfhost/cmd/ww/main.ww, symmetrically (rule-10),
and the stale Makefile combined.ww test-comments (enumcap bigmod.unit.ww
+ 784/787/792/794/848 sep .s cmp + make-smoke sep self-compile).
Closes M4 and epic #22. all 445 pass; 990/993/994/995 byte-id HOLD;
sizelint clean.
This commit is contained in:
@@ -218,10 +218,9 @@ enumerate_dir_ww(const char *dirpath, char ***out_files)
|
||||
* but ww corpus settled on the un-underscored shape). */
|
||||
if (nl >= 7 && strcmp(nm + nl - 7, "test.ww") == 0)
|
||||
continue;
|
||||
/* skip "*.combined.ww" — driver-generated concat
|
||||
* artifacts (the previous build leaves them next to
|
||||
* the source). They look like .ww but parse-erroring
|
||||
* when re-included. */
|
||||
/* skip "*.combined.ww" — legacy amalgamator artifacts
|
||||
* (pre-#87): they look like .ww but parse-error when
|
||||
* re-included, and the sep driver no longer writes them. */
|
||||
if (nl >= 12 && strcmp(nm + nl - 12, ".combined.ww") == 0)
|
||||
continue;
|
||||
if (n + 1 > cap) {
|
||||
@@ -240,7 +239,7 @@ enumerate_dir_ww(const char *dirpath, char ***out_files)
|
||||
* ww build — separate-compilation driver (task #46/c3).
|
||||
* ====================================================================
|
||||
* This is the SOLE build path (E3-C1 flip, task #87): the legacy
|
||||
* single-file amalgamator (build_one/expand) is gone. Each imported
|
||||
* single-file amalgamator is gone. Each imported
|
||||
* package's `.wwi` interface is materialized and every package is
|
||||
* compiled on its own (`w6c -c`), then the `.o` set is flat-linked.
|
||||
*
|
||||
@@ -313,10 +312,10 @@ sep_fname(const struct sepgraph *g, int pi, const char *scratch,
|
||||
|
||||
/* unit_has_package — does `path` declare `package <leaf>;` ANYWHERE?
|
||||
* #16 ENFORCE-driver (rob A): distinguishes a genuinely-missing import
|
||||
* from one satisfied by an INLINE package in the same unit. Unlike
|
||||
* peek_package (stops at the FIRST package decl), this scans every line
|
||||
* — single-file multi-package fixtures carry several `package` decls. The
|
||||
* comment-skip line scan + name match mirror peek_package, uncapped. The
|
||||
* from one satisfied by an INLINE package in the same unit. Unlike a
|
||||
* first-package-decl scan, this checks every line — single-file
|
||||
* multi-package fixtures carry several `package` decls. The
|
||||
* comment-skip line scan + name match are uncapped. The
|
||||
* wwstage twin unithaspackage must stay byte-identical (rule 10). */
|
||||
static int
|
||||
unit_has_package(const char *path, const char *leaf)
|
||||
@@ -348,8 +347,9 @@ unit_has_package(const char *path, const char *leaf)
|
||||
/* Scan one source file for top-level `import IDENT;`, resolving each. A
|
||||
* DIRECTORY import is a package boundary: add it as a direct dep of pkg
|
||||
* `pi`. A FILE import is an intra-package split — fold its imports into
|
||||
* `pi` (its bytes join pi's body at emit time). Mirrors expand's scan
|
||||
* but collects package PATHS instead of concatenating bytes (§1.1). */
|
||||
* `pi` (its bytes join pi's body at emit time). Collects package PATHS
|
||||
* rather than concatenating bytes the way the legacy amalgamator did
|
||||
* (§1.1). */
|
||||
static int
|
||||
sep_scan_file(struct sepgraph *g, int pi, const char *file,
|
||||
const char *searchpath, struct ImportSet *filevisit)
|
||||
@@ -383,9 +383,9 @@ sep_scan_file(struct sepgraph *g, int pi, const char *file,
|
||||
/* #16 ENFORCE-driver: an unresolvable import is a hard error,
|
||||
* not a silent skip — EXCEPT when the package is defined INLINE
|
||||
* in the same unit (single-file multi-package; leaf = the last
|
||||
* dotted component). E3-C1: the combined path that used to own
|
||||
* the genuine-missing case is gone, so the sep producer enforces
|
||||
* it here (INV-2, by construction). Mirrors the deleted expand. */
|
||||
* dotted component). E3-C1 (#87): the legacy amalgamator that
|
||||
* used to own the genuine-missing case is gone, so the sep
|
||||
* producer enforces it here (INV-2, by construction). */
|
||||
if (!locate_import(searchpath, path_form, ipath, sizeof ipath,
|
||||
&is_dir)) {
|
||||
const char *dot = strrchr(name, '.');
|
||||
@@ -888,8 +888,7 @@ build_one_sep(const char *src, int entry_is_dir, const char *out,
|
||||
else if (access("lib", 0) == 0) srcdir = "lib";
|
||||
else srcdir = libdir;
|
||||
}
|
||||
/* search path: source-dir, then -I dirs, then srcdir (mirrors
|
||||
* build_one). */
|
||||
/* search path: source-dir, then -I dirs, then srcdir. */
|
||||
char srcd[1024];
|
||||
if (entry_is_dir) {
|
||||
snprintf(srcd, sizeof srcd, "%s", src);
|
||||
@@ -938,9 +937,8 @@ build_one_sep(const char *src, int entry_is_dir, const char *out,
|
||||
/* #79 (-T): lib/test is the synth main's `test.run` callee but @test
|
||||
* files never `import test;`. Inject it as a direct dep of the root so
|
||||
* sep_scan_pkg pulls test + its transitive deps; the producer adds -T
|
||||
* to the root and `test.run` links against test's `.a`. Mirrors the
|
||||
* combined path's auto-bundle (build_one is_test) and the sep_scan_file
|
||||
* dedup-guarded dep append. */
|
||||
* to the root and `test.run` links against test's `.a` — via the
|
||||
* sep_scan_file dedup-guarded dep append. */
|
||||
if (is_test) {
|
||||
char tpath[1024];
|
||||
int tdir = 0;
|
||||
@@ -1014,8 +1012,8 @@ build_one_sep(const char *src, int entry_is_dir, const char *out,
|
||||
/* wrap each DEP package's `.o` in its own deterministic `.a`
|
||||
* (5a). The ROOT stays a positional `.o` (force-loaded — it's
|
||||
* the build target, always fully linked), so `main` is defined
|
||||
* before any archive is processed, matching build_one's root
|
||||
* treatment. The link consumes `.o`/`.a`, never `.wwi`. */
|
||||
* before any archive is processed. The link consumes `.o`/`.a`,
|
||||
* never `.wwi`. */
|
||||
if (pi != root) {
|
||||
char apath[1024];
|
||||
sep_fname(g, pi, scratch, ".a", apath, sizeof apath);
|
||||
@@ -1114,7 +1112,7 @@ basename_no_ext(const char *path, char *out, size_t outsz)
|
||||
* . → cwd as a directory
|
||||
* foo (bare) → walk cwd:incs:WW_LIB; first hit is dir or file.
|
||||
* Sets *is_dir on hit. Dir resolution drives directory-as-module
|
||||
* enumeration in build_one. */
|
||||
* enumeration in build_one_sep. */
|
||||
static int
|
||||
resolve_module(const char *name, const char *incs, char *out, size_t outsz,
|
||||
int *is_dir)
|
||||
@@ -1317,8 +1315,8 @@ do_run(int argc, char **argv)
|
||||
}
|
||||
char tmp[1024];
|
||||
snprintf(tmp, sizeof tmp, "/tmp/ww_run_%d", getpid());
|
||||
/* objstem = tmp → intermediates land at /tmp/ww_run_<pid>.{s,o,
|
||||
* combined.ww}, never next to the source (T3). */
|
||||
/* objstem = tmp → intermediates land under /tmp/ww_run_<pid>.sepwork/,
|
||||
* never next to the source (T3). */
|
||||
if (build_one_sep(resolved, is_dir, tmp, tmp, incs, libs, libdirs, 0) != 0)
|
||||
return 1;
|
||||
/* exec the built binary with any trailing argv as its argv. */
|
||||
@@ -1347,9 +1345,10 @@ do_test(int argc, char **argv)
|
||||
const char *src = NULL;
|
||||
char incs[2048] = {0};
|
||||
/* -c (compile-only, Go's `go test -c`) + -o <stem> build the test
|
||||
* binary (and its lib/test-inclusive combined, via build_one's
|
||||
* binary (and its lib/test-inclusive sep unit, via build_one_sep's
|
||||
* is_test auto-bundle + the T3 objstem redirect) WITHOUT running it —
|
||||
* the byte-id gates feed <stem>.combined.ww to raw w6c -T / w6c_ww -T.
|
||||
* the byte-id gates feed <stem>.sepwork/__root.unit.ww to raw
|
||||
* w6c -T / w6c_ww -T.
|
||||
* -T stays internal to w6c; the driver never sees it. -l/-L carry no
|
||||
* meaning for a test build, so they (and any unknown flag) are rejected
|
||||
* rather than silently swallowed — byte-identical wording to the
|
||||
|
||||
Reference in New Issue
Block a user