Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/stdarg-sentinel-1.c

raw
1 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
2
3 #define NULL ((void *)0)
4
5 void test_sentinel (int arg, ...)
6 {
7 const char *s;
8 __builtin_va_list ap;
9 __builtin_va_start (ap, arg);
10 while (s = __builtin_va_arg (ap, char *)) /* { dg-warning "'ap' has no more arguments \\(2 consumed\\)" } */
11 {
12 (void)s;
13 }
14 __builtin_va_end (ap);
15 }
16
17 void test_caller (void)
18 {
19 test_sentinel (42, "foo", "bar", NULL);
20 }
21
22 void missing_sentinel (void)
23 {
24 test_sentinel (42, "foo", "bar");
25 }