Skip to content

Commit 9c00a0f

Browse files
committed
Fix CASTBridging.h for non-Clang host compilers
1 parent 39f54bc commit 9c00a0f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

include/swift/AST/CASTBridging.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef SWIFT_C_AST_ASTBRIDGING_H
1414
#define SWIFT_C_AST_ASTBRIDGING_H
1515

16+
#if __clang__
1617
// Provide macros to temporarily suppress warning about the use of
1718
// _Nullable and _Nonnull.
1819
#define SWIFT_BEGIN_NULLABILITY_ANNOTATIONS \
@@ -22,11 +23,19 @@
2223

2324
#define SWIFT_END_NULLABILITY_ANNOTATIONS \
2425
_Pragma("clang diagnostic pop") _Pragma("clang assume_nonnull end")
26+
#else
27+
#define SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
28+
#define SWIFT_END_NULLABILITY_ANNOTATIONS
29+
#endif
2530

2631
//===----------------------------------------------------------------------===//
2732
// Diagnostic Engine
2833
//===----------------------------------------------------------------------===//
2934

35+
#ifndef __has_attribute // Optional of course.
36+
#define __has_attribute(x) 0 // Compatibility with non-clang compilers.
37+
#endif
38+
3039
// TODO: Move this to somewhere common header.
3140
#if __has_attribute(enum_extensibility)
3241
#define ENUM_EXTENSIBILITY_ATTR(arg) __attribute__((enum_extensibility(arg)))

0 commit comments

Comments
 (0)