← board

--strict — opt-in standard-Pascal / FPC-parity mode (umbrella)

Decision (2026-06-27) — single umbrella, not a switch zoo

PXX has accreted several leniencies vs standard Pascal (forward auto-resolve; optional statement separators; more will surface as the FPC seed peels back, each masked wall = one more leniency). Do not grow one flag per nag. Wrap them in one name: --strict (+ {$MODE STRICT} / {$STRICT ON}), default off, which --mimic-fpc turns on. Internally sets the umbrella define PXX_STRICT (and per-check defines like PXX_REQUIRE_FORWARD, PXX_REQUIRE_SEPARATOR).

Sub-checks under the umbrella (grow this list as walls surface):

Default matrix (user call, 2026-06-27)

Open question

Should require-separator be ON by default (PXX errors on missing ; always, since separator-leniency can silently change semantics — mask a dropped statement / mis-attach control flow), or only under --strict (consistent with forwards being opt-in)? Lean: at minimum, warn when tolerating a missing ; even outside --strict (forward-tolerance can stay silent; separator-tolerance should nag). Decide at build time.

Problem

PXX's declaration pre-scan registers every top-level header up front, so call/use-before-define and forward-free mutual recursion always compile. FPC does not: it is single-pass and resolves a routine only if a header is above the call (full def / forward; / an interface section / a class-record method decl). So PXX silently accepts source shapes that the FPC cold seed (make bootstrap, make test-fpc) rejects. We only discover the gap when FPC actually runs — slow, and requires an FPC install.

Goal: an opt-in mode where PXX enforces FPC's ordering rule, so a normal PXX compile (no FPC) tells you "this will fail the seed."

Proposal

CRITICAL: own define, NOT FPC

The strict define must be PXX_REQUIRE_FORWARD, distinct from FPC. --mimic-fpc already installs the FPC define (see defs.inc:737), and FPC activates compiler.pas:26 {$ifdef FPC} uses SysUtils, BaseUnix — FPC RTL units PXX does not provide. So you cannot reuse FPC for strictness without dragging in SysUtils and breaking the self-build (documented "mimic during self-build = broken bootstrap"). The forwards.inc guard in [[bug-fpc-seed-helper-ordering-after-lua-c-frontend]] therefore widens to {$if defined(FPC) or defined(PXX_REQUIRE_FORWARD)}: real FPC pulls SysUtils + forwards; PXX-strict pulls only forwards, no SysUtils → it can still self-compile.

Why this is the prize

With forwards.inc gated on FPC or PXX_REQUIRE_FORWARD, PXX run with --require-forward includes the same forwards FPC sees and reverts to single-pass resolution → it fails in the exact same place FPC's seed would. That turns "will the cold seed compile?" into a normal, FPC-free PXX compile. A fast local proxy for make bootstrap seed-compat, no FPC install needed.

Implementation options (pick during build)

Lean B for UX; note A as the simplest faithful fallback.

Scope decision (call out in build)

FPC ordering strictness covers types and consts too (pointer-to-record defined later, const-before-use), which the pre-scan also masks. The current compiler source already seeds under FPC (modulo the two routine bugs), so it is mostly type/const-clean. Decide: routines-only first (covers the known pain), or full ordering. Recommend routines-first, widen if a type/const seed break shows.

Acceptance

Bonus — FPC-free seed-compat self-test (the extra test)

Add a gate that self-compiles the compiler under --require-forward (with forwards.inc present via PXX_REQUIRE_FORWARD): it must compile clean, proving the source is FPC-seed-ordering-clean without invoking FPC. Candidate make target test-require-forward-selfhost.

NB: run this under --require-forward, not --mimic-fpc. mimic defines FPCuses SysUtils, BaseUnix → self-build breaks (defs.inc:737). The standalone strict flag is the one that both enforces ordering and stays SysUtils-free, so it is the only one that can actually self-compile. (Compiling under --mimic-fpc would additionally need the uses SysUtils line decoupled from the strictness axis — out of scope; the strict-flag self-test gives the same ordering signal without that.)

Landmines

Log

2026-07-14 — RESOLVED (b363): option B (position check), routines-first