Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / uninit-2.c
blob352bbac06c52c6fcac16e9bfd0e61776f9a26d22
1 /* Spurious uninitialized variable warnings, case 2.
2 Taken from cpphash.c (macroexpand) */
3 /* { dg-do compile } */
4 /* { dg-options "-O -Wuninitialized" } */
6 struct definition
8 int nargs;
9 int rest_args;
12 struct cpp_reader;
14 enum cpp_token
16 CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN
19 extern enum cpp_token macarg (struct cpp_reader *, int);
21 void
22 macroexpand (struct cpp_reader *pfile, struct definition *defn)
24 int nargs = defn->nargs;
26 if (nargs >= 0)
28 enum cpp_token token; /* { dg-bogus "token" "uninitialized variable warning" } */
29 int i, rest_args;
30 i = 0;
31 rest_args = 0;
34 if (rest_args)
35 continue;
36 if (i < nargs || (nargs == 0 && i == 0))
38 /* if we are working on last arg which absorbs rest of args... */
39 if (i == nargs - 1 && defn->rest_args)
40 rest_args = 1;
41 token = macarg (pfile, rest_args);
43 else
44 token = macarg (pfile, 0);
45 if (token == CPP_EOF || token == CPP_POP)
46 return;
48 i++;
50 while (token == CPP_COMMA);