forked from OSchip/llvm-project
Make __has_extension(assume_nonnull) always true.
llvm-svn: 240969
This commit is contained in:
parent
51e3d7b2e0
commit
cdfea9a7a7
|
@ -1226,6 +1226,7 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) {
|
||||||
// Because we inherit the feature list from HasFeature, this string switch
|
// Because we inherit the feature list from HasFeature, this string switch
|
||||||
// must be less restrictive than HasFeature's.
|
// must be less restrictive than HasFeature's.
|
||||||
return llvm::StringSwitch<bool>(Extension)
|
return llvm::StringSwitch<bool>(Extension)
|
||||||
|
.Case("assume_nonnull", true)
|
||||||
.Case("nullability", true)
|
.Case("nullability", true)
|
||||||
// C11 features supported by other languages as extensions.
|
// C11 features supported by other languages as extensions.
|
||||||
.Case("c_alignas", true)
|
.Case("c_alignas", true)
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
# error assume_nonnull feature is not set
|
# error assume_nonnull feature is not set
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !__has_extension(assume_nonnull)
|
||||||
|
# error assume_nonnull extension is not set
|
||||||
|
#endif
|
||||||
|
|
||||||
void test_pragmas_1(A * _Nonnull a, AA * _Nonnull aa) {
|
void test_pragmas_1(A * _Nonnull a, AA * _Nonnull aa) {
|
||||||
f1(0); // okay: no nullability annotations
|
f1(0); // okay: no nullability annotations
|
||||||
f2(0); // expected-warning{{null passed to a callee that requires a non-null argument}}
|
f2(0); // expected-warning{{null passed to a callee that requires a non-null argument}}
|
||||||
|
|
Loading…
Reference in New Issue