36 lines · c
1void 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 5void f2(int * _Nonnull);6 7#include "nullability-consistency-2.h"8 9void 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 warn13}14 15class 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 24template <typename T>25struct Typedefs {26 typedef T *Base; // no-warning27 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 32Typedefs<int> xx;33Typedefs<void *> yy;34 35 36