Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wnonnull4.C

raw
1 // PR c++/86210
2 // { dg-do compile }
3 // { dg-options "-Wnonnull" }
4
5 void *declared_not_defined (void *p) __attribute__((nonnull));
6
7 inline void *declared_and_defined (void *p) __attribute__((nonnull));
8
9 int
10 main ()
11 {
12 int *const p = 0;
13 declared_not_defined (p); // { dg-warning "argument 1 null where non-null expected" }
14 declared_and_defined (p); // { dg-warning "argument 1 null where non-null expected" }
15 }
16
17 void *
18 declared_and_defined (void *p)
19 {
20 return p;
21 }