[fpc-devel] Problem with unit initialization order

Florian Klaempfl florian at freepascal.org
Wed Sep 8 14:05:52 CEST 2010

Am 05.09.2010 18:30, schrieb Hans-Peter Diettrich:
> Jonas Maebe schrieb:
>>>> * I assume
>>>> that all the code you added in psystem.pas is with the long term view
>>>> of making the parser independent. However, that is a separate project
>>>> and not part of removing global variables from the compiler
>>> Both are related, since the "stateful" variables are related to
>>> current_module, and that's where the scanner and parser is involved,
>>> somehow.
>> That does not answer my remark, but I don't know how to make my point
>> clearer.
> After a review of psystem, I found the changes related to the weak setup
> of the nodetype and other classtype variables, in the general and target
> specific units. It's an independent part of my work, that can be undone
> and treated as a separate improvement. The general idea is like this:
> Before: In order to avoid references to target specific units, a couple
> of classtype variables have been established in various units. The
> original implementation initializes these variables in the general
> compiler units, together with the related class declarations. Later on
> some values are overridden by CPU specific classes, in CPU specific
> units, what also happens in the unit initialization section. This leads
> to dependencies in the *order* of the used units, as I observed after
> moving unit references between the interface and implementation uses
> clauses, resulting in an broken compiler.

Target specific node units should be included only by cpunode. If it is
done this way, there is no problem

More information about the fpc-devel mailing list