nullability macros/syntax causes compilation errors even with Xcode 6.3 installed

Issue #61 closed
Eric Horacek created an issue

I'm receiving the following errors:

COMPILER ERROR when parsing file File.h:1:1: error: unknown property attribute 'nullable`
COMPILER WARNING when parsing file File.h:1:1: warning: ambiguous expansion of macro 'NS_ASSUME_NONNULL_BEGIN' [-Wambiguous-macro]

when running Faux Pas on a project that has nullability macros/syntax, despite the fact that Xcode 6.3 is set as my default CLI tool via xcodeselect

Comments (6)

  1. Ali Rantakari repo owner

    Thanks for reporting this.

    These errors occur when Faux Pas is trying to interpret your code, and doesn't understand these new nullability features — v1.4 is using a version of Clang that matches the one in Xcode 6.1, and unfortunately Apple has not yet released the source code for the version of Clang that has these features.

    Until Faux Pas gains support for these, here's a workaround: you can use macros like these to gracefully get rid of nullability annotations on compilers that don't support them: https://gist.github.com/steipete/d9f519858fe5fb5533eb.

    The above workaround may not be very desireable, though, because it forces you to prefix all of your nullability annotations. A less invasive option is suggested in the comments of that Gist, but that might cause collateral damage in some projects.

    If you are not willing to modify your project (add a header) in order to try these workarounds, you can try adding these values to the “Additional compiler arguments to use” (--extraCompilerArgs) option in Faux Pas:

    -D__nullable=
    -D__nonnull=
    -D__null_unspecified=
    -Dnullable=
    -Dnonnull=
    -Dnull_resettable=
    -Dnull_unspecified=
    -DNS_ASSUME_NONNULL_BEGIN=
    -DNS_ASSUME_NONNULL_END=
    

    This is the same as the “less invasive” option mentioned above, but applied only for Faux Pas. As such, it has the same caveat that it might cause collateral damage (if e.g. nullable is spelled in some other context in the code).

  2. Former user Account Deleted

    Any updates on this issue? "unfortunately Apple has not yet released the source code for the version of Clang that has these features." - is it still the case?

  3. Ali Rantakari repo owner

    This will be fixed in the next release. I don't have a set date for it but I should be able to get it out pretty soon.

  4. Log in to comment