> On Feb 12, 2015, at 9:18 AM, Jens Alfke <[email protected]> wrote: > > >> On Feb 11, 2015, at 11:55 PM, Roland King <[email protected] >> <mailto:[email protected]>> wrote: >> >> I’m guessing it’s >> __has_feature( nullability ) > > That works — thanks! > > So the magic invocation I’m putting in my header files (after the #includes) > is: > > #if __has_feature(nullability) // Xcode 6.3+ > #pragma clang assume_nonnull begin > #else > #define nullable > #define __nullable > #endif > > … interface declarations go here… > > #if __has_feature(nullability) > #pragma clang assume_nonnull end > #endif > > In property declarations you'll need to make “nullable” the last > meta-attribute, otherwise you’ll get syntax errors in earlier versions of > Xcode; so for example “(readonly, nonatomic, nullable)” works but “(readonly, > nullable, nonatomic)” is a syntax error because in Xcode 6.1 the parser will > see two adjacent commas.
Hi Jens, FYI, you can use _Pragma (instead of #pragma) to wrap this up in a nicer macro, but we’re trying to get this taken care for you in a future Beta (something along the lines of NS_ASSUME_NONNULL_BEGIN/END). > [This is working well, but in converting my interfaces I found a nasty > compiler bug that I’m about to submit to Apple — if you declare multiple > properties on a single line, adding the (nullable) attribute will cause the > parser to lock up in an infinite loop: > @property (readonly, nullable) id a, b, c; // don’t do this! > I spent an hour or so with my MBP’s fan running full speed before figuring > out which exact line triggered this.] We’ll investigate, thanks! -Chris
_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com This email sent to [email protected]
