FABAttributes.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // FABAttributes.h
  3. // Fabric
  4. //
  5. // Copyright (C) 2015 Twitter, Inc.
  6. //
  7. // Licensed under the Apache License, Version 2.0 (the "License");
  8. // you may not use this file except in compliance with the License.
  9. // You may obtain a copy of the License at
  10. //
  11. // http://www.apache.org/licenses/LICENSE-2.0
  12. //
  13. // Unless required by applicable law or agreed to in writing, software
  14. // distributed under the License is distributed on an "AS IS" BASIS,
  15. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. // See the License for the specific language governing permissions and
  17. // limitations under the License.
  18. //
  19. #pragma once
  20. #define FAB_UNAVAILABLE(x) __attribute__((unavailable(x)))
  21. #if __has_feature(nullability)
  22. #define fab_nullable nullable
  23. #define fab_nonnull nonnull
  24. #define fab_null_unspecified null_unspecified
  25. #define fab_null_resettable null_resettable
  26. #define __fab_nullable __nullable
  27. #define __fab_nonnull __nonnull
  28. #define __fab_null_unspecified __null_unspecified
  29. #else
  30. #define fab_nullable
  31. #define fab_nonnull
  32. #define fab_null_unspecified
  33. #define fab_null_resettable
  34. #define __fab_nullable
  35. #define __fab_nonnull
  36. #define __fab_null_unspecified
  37. #endif
  38. #ifndef NS_ASSUME_NONNULL_BEGIN
  39. #define NS_ASSUME_NONNULL_BEGIN
  40. #endif
  41. #ifndef NS_ASSUME_NONNULL_END
  42. #define NS_ASSUME_NONNULL_END
  43. #endif
  44. /**
  45. * The following macros are defined here to provide
  46. * backwards compatability. If you are still using
  47. * them you should migrate to the new versions that
  48. * are defined above.
  49. */
  50. #define FAB_NONNULL __fab_nonnull
  51. #define FAB_NULLABLE __fab_nullable
  52. #define FAB_START_NONNULL NS_ASSUME_NONNULL_BEGIN
  53. #define FAB_END_NONNULL NS_ASSUME_NONNULL_END