mirror of
https://github.com/fluffos/fluffos
synced 2026-08-12 18:26:06 -04:00
A '//' comment after a #define body was captured INTO the stored macro body. Expansion buffers carry no newline to end it, so when the macro expanded inside a spliced line (a function-like macro's substituted body, as in the report's MIN(credits, m[e][CREDITS])), the '//' ate the rest of the splice and the parse failed with a baffling 'unexpected ;' attributed to the outer macro. The same missed strip made '#undef X // why' erase nothing and '#ifdef X // why' look up the wrong name and silently take the false branch. Comments are whitespace (C translation phase 3). dispatch_directive now strips them from the payload before parsing for #define (name, params, body -- body also right-trimmed so a stripped comment can't turn '1' vs '1 ' into a spurious redefinition warning), #undef, #ifdef, #ifndef, and #pragma (word-list payload); #if/#elif already stripped. strip_directive_comments() now folds a block comment to ONE space instead of nothing, so '1 -/*c*/-1' keeps its token boundaries instead of pasting '--'. #error/#warn/#echo payloads stay raw. Covered by five new Preprocessor unit tests (the report's repro shape, paste-prevention via #if branch selection, param-list comment, testsuite/single/tests/compiler/preprocessor.lpc; documented in docs/lpc/preprocessor/define.md. Fixes #1240 Claude-Session: https://claude.ai/code/session_016FMBJLkpkpVpZdz6PWzeWe Co-authored-by: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| conditionals.md | ||
| define.md | ||
| include.md | ||
| index.md | ||
| pragma.md | ||