[fpc-pascal] New Cocoa headers

Jonas Maebe jonas at freepascal.org
Thu Aug 22 20:28:48 CEST 2019


On 22/08/2019 20:15, Zoƫ Peterson wrote:
> I just updated to the newer Cocoa headers (Thanks Jonas!) and I've run
> into a problem with Lazarus.
> 
> NSExtensionContext.inc includes this line:
> 
> {$if
> defined(__OBJC2__)defined(interface)defined(NSExtensionContext)defined(NSObject)}
> 
> 
> It compiles ok for some reason, but screws up Code Tools so things like
> jump to inherited don't work on subclasses of AppKit defined Objective-C
> classes.
> 
> Is that line correct?

Syntactically, yes: Borland-style compilers (and hence FPC as well)
ignore all invalid tokens/characters at the end of an $if/$if(n)def
directive. So the above is equivalent to {$if defined(__OBJC2__)}.

> Do it (and other places that have the same
> construct) need to be fixed or does Code Tools need to be updated to
> understand it?

The latter definitely. The former, possibly as well (although the
compiler currently never defines __OBJC2__, so it won't make a
difference at this time).


Jonas


More information about the fpc-pascal mailing list