| 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 | |
| 20 | #pragma once |
| 21 | |
| 22 | #define FAB_UNAVAILABLE(x) __attribute__((unavailable(x))) |
| 23 | |
| 24 | #if !__has_feature(nullability) |
| 25 | #define nonnull |
| 26 | #define nullable |
| 27 | #define _Nullable |
| 28 | #define _Nonnull |
| 29 | #endif |
| 30 | |
| 31 | #ifndef NS_ASSUME_NONNULL_BEGIN |
| 32 | #define NS_ASSUME_NONNULL_BEGIN |
| 33 | #endif |
| 34 | |
| 35 | #ifndef NS_ASSUME_NONNULL_END |
| 36 | #define NS_ASSUME_NONNULL_END |
| 37 | #endif |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * The following macros are defined here to provide |
| 42 | * backwards compatability. If you are still using |
| 43 | * them you should migrate to the native nullability |
| 44 | * macros. |
| 45 | */ |
| 46 | #define fab_nullable nullable |
| 47 | #define fab_nonnull nonnull |
| 48 | #define FAB_NONNULL __fab_nonnull |
| 49 | #define FAB_NULLABLE __fab_nullable |
| 50 | #define FAB_START_NONNULL NS_ASSUME_NONNULL_BEGIN |
| 51 | #define FAB_END_NONNULL NS_ASSUME_NONNULL_END |