Consecutive empty macro expansions behave as nested and can easily exceed nesting limit.
Original Reporter info from Mantis: runewalsh
-
Reporter name:
Original Reporter info from Mantis: runewalsh
- Reporter name:
Description:
Bugfixes of {IFDEF X}+{
ELSEIF} that were recently brought up (#34858 (closed)) reminded me about an unrelated preprocessor bug I found already quite some time ago.
When consecutive macro expansions give no source code:
{define a :=} {
define b :=} {$define c :=} (... and so on, 16 empty macros ...)
a b c (... expand all of them — without nesting! ...)
they count against macro nesting limit as if they were nested one inside another, instead of just 1 level. This breaks some otherwise valid scenarios. I made a simple example, and a more elaborate one.
Steps to reproduce:
Uncomment 'function YellowishColors' in the 'macro_colors.pas', and try to compile.
Or just compile 'simple_example.pas'.
Mantis conversion info:
- Mantis ID: 38802
- Build: r49167 [2021/04/10]
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 49265 (#77cc2f4c)