You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

6 years ago
  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 nonnull
  23. #define nullable
  24. #define _Nullable
  25. #define _Nonnull
  26. #endif
  27. #ifndef NS_ASSUME_NONNULL_BEGIN
  28. #define NS_ASSUME_NONNULL_BEGIN
  29. #endif
  30. #ifndef NS_ASSUME_NONNULL_END
  31. #define NS_ASSUME_NONNULL_END
  32. #endif
  33. /**
  34. * The following macros are defined here to provide
  35. * backwards compatability. If you are still using
  36. * them you should migrate to the native nullability
  37. * macros.
  38. */
  39. #define fab_nullable nullable
  40. #define fab_nonnull nonnull
  41. #define FAB_NONNULL __fab_nonnull
  42. #define FAB_NULLABLE __fab_nullable
  43. #define FAB_START_NONNULL NS_ASSUME_NONNULL_BEGIN
  44. #define FAB_END_NONNULL NS_ASSUME_NONNULL_END