devel merged to main - what's newA bigger batch than usual - the devel branch just landed on
main. Highlights below.
New intrinsics: PreInc / PostInc / PreDec / PostDecOn by default in
{$mode unleashed}; elsewhere
{$modeswitch prepostincdec}. Pre/post increment and decrement as value-returning builtins: the
Pre pair returns the value after the update, the
Post pair the value read before it. Optional step like
inc/
dec, same operand types (integers, enums, chars, currency, pointers, records with
class operator Inc/
Dec), side-effecting operand address evaluated once, properties hit the getter and setter exactly once.
var i := 10;
a := PostInc(i); // returns old value: a = 10, i = 11
a := PreInc(i); // returns new value: a = 12, i = 12
a := PostDec(i, 3); // optional step: a = 12, i = 9
a := PreDec(i, 4); // a = 5, i = 5
Pattern-detected only when no symbol of that name is in scope, so your own
PreInc keeps working. Docs:
introduced-functions.mdInline overhaul: inline is now forced in unleashed modeIn
{$mode unleashed},
inline means
inline - not "if the compiler feels like it". Cases stock FPC silently gives up on now expand: routines with embedded
asm statements, pure-assembler routines (spliced at the call site), open-array and array-of-const parameters,
inherited calls, a body defined after the call site, and
forward combined with
inline. When an inline still can't happen, you get one clear report at the definition instead of silence. Docs:
forced-inline.mdOptimizer: auto-inlining and devirtualizationProcvar calls with a constant target are devirtualized into direct calls (and can then inline). Auto-inlining and devirtualization decisions are reported as hints, so you can see what the optimizer did.
{$inline off} now genuinely stops all inline expansion, and
{$optimization} accepts trailing
+/
- on a switch. Docs:
optimizations.mdIndexed labels: dispatch upgrade@name[index] is now supported, variable-index dispatch prefers a jump table, a
goto to an undefined member falls through instead of warning, and the label family is frozen once a variable-index
goto is generated. Reference doc expanded.
Fixes- Inline declarations in nested bodies, and as the sole body of a control-flow statement (#21).
- IE 200405231 on an inline call inside finally - also present in stock FPC (upstream #41842).
- win64 external linking: .pdata/.xdata mapped in the ld script + -m i386pep passed - also in stock FPC (upstream #41839).
- Constant folding of add/sub/mul now respects {$q-} - also in stock FPC (upstream #41843).
- zeroinit covers block-scoped locals too.
- Statement-expression branches retype correctly in a set context; constant propagation no longer leaks a constant out of a dead if branch; @label loads survive node copies.
Under the hood- Heap: more empty fixed arenas cached.
- New reference pages: array-equality.md, forced-inline.md, optimizations.md; docs polish across the board.
- Test suite consolidation: fifteen-odd scattered test groups moved into the unleashed suite, i386 suite green again.
Three of the fixes address bugs that exist in stock FPC as well (#41839, #41842, #41843) - reported upstream.