gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSXMLNode ivar type


From: David Chisnall
Subject: Re: NSXMLNode ivar type
Date: Tue, 20 Mar 2018 16:14:47 +0000

On 20 Mar 2018, at 15:36, Ivan Vučica <address@hidden> wrote:
> 
> On Tue 20 Mar 2018 at 14:51 David Chisnall <address@hidden> wrote:
>> Hello the list,
>> 
>> I am working on the new ObjC ABI and one of the changes I have made is to 
>> include the type encoding in the ivar offset variable.  This protects 
>> against type confusion by causing linker failures when an instance variable 
>> is referenced with the wrong type (which can happen if it’s in a library 
>> that changes and someone forgets to bump the SONAME).
>> 
>> Unfortunately, I have found that -base doesn’t build because it uses some 
>> complex preprocessor logic to change the type of NSXMLNode’s node ivar 
>> depending on which subclass you are using.  This is quite dangerous because, 
>> although the types have a common prefix, the version used in the root is not 
>> a prefix of the others and so it’s possible for type confusion if someone 
>> modifies NSXMLNode without realising how the subclasses use this.
>> 
>> Does anyone object if I commit a patch that turns this into a union?
>> 
>> David
>> 
> Please bump the SONAME while at it :)

Why?  It’s an private and hidden ivar.  In the fragile ABI, it’s in the secret 
‘internal’ structure and not ABI-visible, in the non-fragile ABI it’s in a 
class extension and so not externally visible.

David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]