| 1 | void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}} |
| 2 | // expected-note@-1 {{insert '_Nullable' if the pointer may be null}} |
| 3 | // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}} |
| 4 | |
| 5 | void f2(int * _Nonnull); |
| 6 | |
| 7 | #include "nullability-consistency-2.h" |
| 8 | |
| 9 | void f3(int *ptr) { // expected-warning{{pointer is missing a nullability type specifier}} |
| 10 | // expected-note@-1 {{insert '_Nullable' if the pointer may be null}} |
| 11 | // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}} |
| 12 | int *other = ptr; // shouldn't warn |
| 13 | } |
| 14 | |
| 15 | class X { |
| 16 | void mf(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}} |
| 17 | // expected-note@-1 {{insert '_Nullable' if the pointer may be null}} |
| 18 | // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}} |
| 19 | int X:: *memptr; // expected-warning{{member pointer is missing a nullability type specifier}} |
| 20 | // expected-note@-1 {{insert '_Nullable' if the member pointer may be null}} |
| 21 | // expected-note@-2 {{insert '_Nonnull' if the member pointer should never be null}} |
| 22 | }; |
| 23 | |
| 24 | template <typename T> |
| 25 | struct Typedefs { |
| 26 | typedef T *Base; // no-warning |
| 27 | typedef Base *type; // expected-warning{{pointer is missing a nullability type specifier}} |
| 28 | // expected-note@-1 {{insert '_Nullable' if the pointer may be null}} |
| 29 | // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}} |
| 30 | }; |
| 31 | |
| 32 | Typedefs<int> xx; |
| 33 | Typedefs<void *> yy; |
| 34 | |
| 35 | |
| 36 | |