2015-06-20 02:27:45 +08:00
|
|
|
void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}}
|
2016-12-20 04:58:20 +08:00
|
|
|
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
|
|
|
|
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
|
2015-06-20 02:27:45 +08:00
|
|
|
|
2015-06-25 06:02:08 +08:00
|
|
|
void f2(int * _Nonnull);
|
2015-06-20 02:27:45 +08:00
|
|
|
|
|
|
|
#include "nullability-consistency-2.h"
|
|
|
|
|
|
|
|
void f3(int *ptr) { // expected-warning{{pointer is missing a nullability type specifier}}
|
2016-12-20 04:58:20 +08:00
|
|
|
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
|
|
|
|
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
|
2015-06-20 02:27:45 +08:00
|
|
|
int *other = ptr; // shouldn't warn
|
|
|
|
}
|
|
|
|
|
|
|
|
class X {
|
|
|
|
void mf(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}}
|
2016-12-20 04:58:20 +08:00
|
|
|
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
|
|
|
|
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
|
2015-06-20 02:27:45 +08:00
|
|
|
int X:: *memptr; // expected-warning{{member pointer is missing a nullability type specifier}}
|
2016-12-20 04:58:20 +08:00
|
|
|
// expected-note@-1 {{insert '_Nullable' if the member pointer may be null}}
|
|
|
|
// expected-note@-2 {{insert '_Nonnull' if the member pointer should never be null}}
|
2015-06-20 02:27:45 +08:00
|
|
|
};
|
|
|
|
|
2016-11-03 04:44:07 +08:00
|
|
|
template <typename T>
|
|
|
|
struct Typedefs {
|
|
|
|
typedef T *Base; // no-warning
|
|
|
|
typedef Base *type; // expected-warning{{pointer is missing a nullability type specifier}}
|
2016-12-20 04:58:20 +08:00
|
|
|
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
|
|
|
|
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
|
2016-11-03 04:44:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
Typedefs<int> xx;
|
|
|
|
Typedefs<void *> yy;
|
2015-06-20 02:27:45 +08:00
|
|
|
|
|
|
|
|