Claude being ... clever

Quoting …


The marked() step writes each directive as a marker of its own length, so from {#D1000} on, the markers outgrow the 7-character {$else}, making FastMM4’s configurations unmarkable and sending delfc to whole-file reading.
I’m checking where the marker is read back next.

Searched for 1 pattern, read 1 file

I’ll write the number in base 36 (digits, then capital letters).
A {$else} then has room for 46,656 directives instead of 1,000, and the marker keeps its {#D…} form.


I don’t understand atm why we needed this.

I’ll explain that next. First, which three files the change fixed:

Ran 2 shell commands

The fix works. FastMM4, Indy’s IdSSLOpenSSLHeaders and JVCL’s DirectXGraphics no longer have errors.
Plain error files went 65 → 62, and .delf 91 → 88, and both 300-file samples are unchanged.

Why base 36 was needed :

FastMM4’s code was never the problem. nostackframe is a Free Pascal word, inside {$ifdef fpc64bit}, which only an FPC build defines. A Delphi build never sees it, and delfc knows that. The problem was in how delfc builds each configuration’s text:

  1. For each configuration, delfc blanks the branches that are off. Each directive it keeps is replaced by a marker comment of exactly the same length, so line and column positions don’t move. {$else} (7 characters) becomes {#D12 }, meaning “directive number 12”.
  2. The marker has to fit inside the directive it replaces. With the number in decimal, {$else} has room for {#D999} at most. From directive 1000 on, {#D1000} is 8 characters and doesn’t fit.
  3. FastMM4 has more than 1,000 directives (1,106 branches).
    Every one of its 14 configurations hit a {$else} past number 999, so none could be built.
  4. delfc’s fallback when no configuration can be built is to read the whole file with every branch on at once.
    That includes the FPC-only branches, hence 18 syntax errors at nostackframe.

Writing the number in base 36 (0–9, then A–Z) makes it shorter: 1000 becomes RS, so {#DRS} fits easily. A {$else} can now hold numbers up to 46,655, so files have room for about 46,000 directives instead of 1,000.
The other two files had the same cause: they’re also long files full of conditionals.

The leftover parse failures are now 62 plain error files and 88 .delf.

:fire: :tada: (out of 16,708 files)