Debian Codegraph @

gcc/testsuite/gcc.dg/cpp/embed-14.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-std=gnu23 -Wnonnull" } */
3
4 #define A(n) int *p##n
5 #define B(n) A(n##0), A(n##1), A(n##2), A(n##3), A(n##4), A(n##5), A(n##6), A(n##7)
6 #define C(n) B(n##0), B(n##1), B(n##2), B(n##3), B(n##4), B(n##5), B(n##6), B(n##7)
7 #define D C(0), C(1), C(2), C(3)
8
9 void foo (D) __attribute__((nonnull ( /* { dg-message "in a call to function 'foo' declared 'nonnull'" } */
10 #embed __FILE__ limit (128)
11 )));
12 [[gnu::nonnull (
13 #embed __FILE__ limit (128)
14 )]] void bar (D); /* { dg-message "in a call to function 'bar' declared 'nonnull'" } */
15
16 #undef A
17 #define A(n) nullptr
18
19 void
20 baz ()
21 {
22 foo (D); /* { dg-warning "argument \[0-9]\+ null where non-null expected" } */
23 bar (D); /* { dg-warning "argument \[0-9]\+ null where non-null expected" } */
24 }