aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/stdarg-sentinel-1.c
blob: f8c1f0eb0f82b7205e61eab72dd6ca34a9b30708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* { dg-additional-options "-Wno-analyzer-too-complex" } */

#define NULL ((void *)0)

void test_sentinel (int arg, ...)
{
  const char *s;
  __builtin_va_list ap;
  __builtin_va_start (ap, arg);
  while (s = __builtin_va_arg (ap, char *)) /* { dg-warning "'ap' has no more arguments \\(2 consumed\\)" } */
    {
      (void)s;
    }
  __builtin_va_end (ap);
}

void test_caller (void)
{
  test_sentinel (42, "foo", "bar", NULL);
}

void missing_sentinel (void)
{
  test_sentinel (42, "foo", "bar");
}