17 lines · c
1#define SUPPRESS_NULLABILITY_WARNING(Type) \2 _Pragma("clang diagnostic push") \3 _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"") \4 Type \5 _Pragma("clang diagnostic pop")6 7void suppress1(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning8 9void shouldwarn5(int *ptr); //expected-warning{{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 13void trigger5(int * _Nonnull);14 15void suppress2(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning16 17