blob: d70087df9f1fccd26dd2222f0d653181663b8ee5 [file] [log] [blame]
Douglas Gregor261a89b2015-06-19 17:51:05 +00001// RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify
2
Douglas Gregoraea7afd2015-06-24 22:02:08 +00003_Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}}
Douglas Gregor261a89b2015-06-19 17:51:05 +00004
5#pragma clang diagnostic push
6#pragma clang diagnostic ignored "-Wnullability-extension"
Douglas Gregoraea7afd2015-06-24 22:02:08 +00007_Nonnull int *ptr2; // no-warning
Douglas Gregor261a89b2015-06-19 17:51:05 +00008#pragma clang diagnostic pop
9
Douglas Gregor55c4ef32015-06-29 18:15:31 +000010#if !__has_feature(nullability)
11# error Nullability should always be supported
Douglas Gregor261a89b2015-06-19 17:51:05 +000012#endif
13
Jordan Rose303e2f12016-11-10 23:28:17 +000014#if !__has_feature(nullability_on_arrays)
15# error Nullability on array parameters should always be supported
16#endif
17
Douglas Gregor261a89b2015-06-19 17:51:05 +000018#if !__has_extension(nullability)
19# error Nullability should always be supported as an extension
20#endif
Jordan Rose303e2f12016-11-10 23:28:17 +000021
22#if !__has_extension(nullability_on_arrays)
23# error Nullability on array parameters should always be supported as an extension
24#endif