Menu

#467 Nested IFDEF also indents other compiler directives

Closed
closed-wont-fix
formatter (26)
5
2026-01-30
2026-01-28
No

When nested indentation for {$IFDEF} is enabled, other compiler directives are also indented:

{$IFDEF WIN32}
uses
  u_dzFileStreams;

  {$L adler32.obj}

The line with {$L should not be indented

Discussion

  • Thomas Mueller

    Thomas Mueller - 2026-01-30
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,6 @@
     When nested indentation for {$IFDEF} is enabled, other compiler directives are also indented:
     ~~~
    -$IFDEF WIN32}
    +{$IFDEF WIN32}
     uses
       u_dzFileStreams;
    
    • status: open --> closed-wont-fix
    • Group: New --> Closed
     
  • Thomas Mueller

    Thomas Mueller - 2026-01-30

    This is working as designed. It makes sense because the {$L bla} directive will be ignored if {$IFDEF WIN32} is false.

    It looks wrong on first glance, though, but consider a different example:

    {$IFDEF WIN32}
      {$MESSAGE HINT 'Compiling for WIN32'}
    {$ELSE}
      {$MESSAGE HINT 'Compiling for something else'}
    {$ENDIF}
    
     

Log in to post a comment.