@mh @ck You see gentleman how much of a hassle the new behavior of conditional compilation can cause and how great joy is the discovery of <UseLegacyPreprocessor>
is!
I will follow your request to show you constructs that cause errors in conditionally compiled code but I honestly think you should maybe reconsider this a bit. Like you had issue you had asked about elsewhere about conditionally defined uses
clause:
uses
{$ifdef FPC}
Classes,
SysUtils,
Types,
Math;
{$else}
System.Threading,
System.Text;
{$endif}
First, you compile it you got:
(E1) {$ENDIF} expected, got ;
at the line with Math;
and:
(E278) No matching $IFDEF for $ELSE
exactly at the line with {$else}
.
and:
(E3) "implementation" or interface section members (types or methods) expected
line below. You thing you got crazy, because you see {$else}
and you are sure it is absolutely impossible to interpret code in this area. So you check whether project is OK and whether proper compiler is applied. It takes about a quarter. Then you think maybe conditional defines case is imposed? You change it. Nothing.
I have figured out, on my own, that I should use semi colon OUTSIDE of conditional clause but it took about three quarters and requires to carefully modify every single module!
Few lines below I find another example:
TSomeEvent = {$ifdef FPC} procedure {$else} delegate {$endif}(
Sender: TObject; Reason: integer){$ifdef FPC} of object {$endif};
generates two even more confusing errors:
(E1) semicolon (;) expected, got open parenthesis
at first line and
(E1) equals (=) expected, got colon (:)
at the second.
Please, forgive me to say this, but it is crazy!
I really expect conditionally disabled code not to be interpreted! I understand there is some indication for this in the internal structure but it is highly confusing.
Precisely speaking you want me to redact the code twice in Oxygene and once in FPC. And the compiler is not helping but obstructing, because you have to watch what is going on in sections that you are used to watch in different circumstances (FPC). It is going to be highly distracting.