Skip to content

Instantly share code, notes, and snippets.

@aoopvn
Forked from steipete/NullabilityMacros.h
Last active August 29, 2015 14:21
Show Gist options
  • Save aoopvn/47c26ab5f29fbfe2409e to your computer and use it in GitHub Desktop.
Save aoopvn/47c26ab5f29fbfe2409e to your computer and use it in GitHub Desktop.
// Xcode 6.3 defines new language features to declare nullability
#if __has_feature(nullability)
#define PSPDF_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
#define PSPDF_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
#define ps_nullable nullable
#define ps_nonnull nonnull
#define ps_null_unspecified null_unspecified
#define ps_null_resettable null_resettable
#define __ps_nullable __nullable
#define __ps_nonnull __nonnull
#define __ps_null_unspecified __null_unspecified
#else
#define PSPDF_ASSUME_NONNULL_BEGIN
#define PSPDF_ASSUME_NONNULL_END
#define ps_nullable
#define ps_nonnull
#define ps_null_unspecified
#define ps_null_resettable
#define __ps_nullable
#define __ps_nonnull
#define __ps_null_unspecified
#endif
@aoopvn
Copy link
Author

aoopvn commented May 13, 2015

should look back to the original gist

#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable
#define nonnull
#define null_unspecified
#define null_resettable
#define __nullable
#define __nonnull
#define __null_unspecified
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment