[fpc-pascal]Extension of macros exceeds a depth of 16
Olle Raab
olle.r at automagika.se
Sun Aug 22 15:14:48 CEST 2004
04-08-04 13.39, skrev Olle Raab följande:
> 04-07-28 21.42, skrev Alan Mead följande:
>
>> As a I mentined earlier today in a different thread, I have upgraded
>> to 1.9.4 and I appreciate the greater checking.
>>
>> Most of the new warnings I get are clear but one of my units now
>> reports "Extension of macros exceeds a depth of 16". What does this
> ^^^^^^^^^^
> Actually I think the warning message is wrong..
>
> It should imo be "Expanding". I'll fix this.
>
>> warning mean and what is the rammification of ignoring it?
>>
>> The line number where it reports the warning is an {$if def ...} and
>> I would assume the warning had something to do with nesting compiler
>> conditionals... but that's not the case (unless the parser is really
>> getting lost... but since the code operates, I cannot imagne that
>> this is happening..). This conditional should be at the "top
>> level"--it is not nested under anything.
>
> It the recursive macro substitution which exceeds a depth of 16.
>
> This is probably due to a circular definition of a macro, e g
>
> {$DEFINE X = X}
>
> So that X is replaced by X, which is replaced by X etc. This is probably not
> what you want.
>
> After 16 replacements the recursion is stoped, thats what it is warned
> about.
I found that there really was a bug here.
With
{$DEFINE X}
{$IF X = 1}
etc..
You get the above error message, just because X does not have any value.
(it then erroneously made a recurson). This is now fixed.
On the other hand, the above snippet is actually worng, beacause X does not
hae any value, and should not be allowed in an expression.
I will add error checking for this.
Olle
More information about the fpc-pascal
mailing list