summary_m2make-adapt.md 2.4 KB

Step: M2make adapted to the current compiler

Tag v3-m2make-adapt. M2make suite 18/18; compiler suite 137/137; fixpoint OK (2,156,095 bytes).

Why

tools/m2make/M2make.mod is a dual-target build front-end (GNU Modula-2 and V3). Its source and README still carried workarounds for compiler limits that V3 has since outgrown, and its self-build did not use the driver it produces.

What changed

  1. Source re-probed and relaxed. Every "both compilers must accept" bullet was re-tested against the current gm2 -fiso and V3:
    • AND/OR short-circuit in both now, so the string helpers dropped their done-flag / index-stop gymnastics for ordinary guarded loops (Len, Cmp, Cat, Sub, Lower).
    • nested arrays and nested-element open-array actuals work; the flat pools are now documented as a style choice, not a limit.
    • LONGINT function results compile; only VAL(INTEGER, long) (64→32) is still rejected, so LONGINT stays a VAR out-parameter across the M2makeOS boundary.
  2. --extra <path> option. m2 mode links the C shim plus an extra C file (cc <image>.s <shim> [<extra>] -o <out> -lm), so a tool shipping its own C shim (M2make's m2make_os.c) can drive its own build. Usage text updated.
  3. build_m2.sh dogfoods. It sets the previous b_v3/M2make aside, and if one exists it drives the build itself (M2make -c m2 --extra m2make_os.c -I runtime/syslib …); the first run (no driver) falls back to the hand-spelled session. Re-running the script is thus a small self-host check for the tool. (The previous driver predates --extra, so the very first dogfood run after this change bootstraps once.)
  4. README refreshed — the --extra flag, the -I module resolution shape (same as bootstrap/fixpoint.sh), and the corrected constraint list.

Verified

  • tools/m2make/tests/run_tests.sh → 18/18 (both compilers build M2make; ordering, cycle detection, real gm2/m2 builds, up-to-date skips, and the cross-driver case).
  • build_m2.sh clean build (bootstrap path), then a dogfood run driven by the freshly built b_v3/M2make.
  • Compiler suite 137/137; bootstrap/fixpoint.sh FIXPOINT OK.

Files

tools/m2make/M2make.mod (string helpers, --extra, usage), tools/m2make/build_m2.sh, tools/m2make/README.md.