Skip to content

Commit 4ce44c2

Browse files
authored
Update CBasicBridging.h
1 parent 449a1ce commit 4ce44c2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

include/swift/Basic/CBasicBridging.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,23 @@ typedef __swiftc_intn_t(__INTPTR_WIDTH__) SwiftInt;
8383
typedef __swiftc_uintn_t(__INTPTR_WIDTH__) SwiftUInt;
8484
#endif
8585

86+
#if __clang__
87+
// Provide macros to temporarily suppress warning about the use of
88+
// _Nullable and _Nonnull.
89+
#define SWIFT_BEGIN_NULLABILITY_ANNOTATIONS \
90+
_Pragma("clang diagnostic push") \
91+
_Pragma("clang diagnostic ignored \"-Wnullability-extension\"") \
92+
_Pragma("clang assume_nonnull begin")
93+
94+
#define SWIFT_END_NULLABILITY_ANNOTATIONS \
95+
_Pragma("clang diagnostic pop") _Pragma("clang assume_nonnull end")
96+
#else
97+
#define SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
98+
#define SWIFT_END_NULLABILITY_ANNOTATIONS
99+
#define _Nullable
100+
#define _Nonnull
101+
#endif
102+
86103
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
87104

88105
#ifdef __cplusplus

0 commit comments

Comments
 (0)