OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [uninit-2.c] - Blame information for rev 750

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Spurious uninitialized variable warnings, case 2.
2
   Taken from cpphash.c (macroexpand) */
3
/* { dg-do compile } */
4
/* { dg-options "-O -Wuninitialized" } */
5
 
6
struct definition
7
{
8
  int nargs;
9
  int rest_args;
10
};
11
 
12
struct cpp_reader;
13
 
14
enum cpp_token
15
{
16
  CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN
17
};
18
 
19
extern enum cpp_token macarg (struct cpp_reader *, int);
20
 
21
void
22
macroexpand (struct cpp_reader *pfile, struct definition *defn)
23
{
24
  int nargs = defn->nargs;
25
 
26
  if (nargs >= 0)
27
    {
28
      enum cpp_token token;  /* { dg-bogus "token" "uninitialized variable warning" } */
29
      int i, rest_args;
30
      i = 0;
31
      rest_args = 0;
32
      do
33
        {
34
          if (rest_args)
35
            continue;
36
          if (i < nargs || (nargs == 0 && i == 0))
37
            {
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);
42
            }
43
          else
44
            token = macarg (pfile, 0);
45
          if (token == CPP_EOF || token == CPP_POP)
46
            return;
47
 
48
          i++;
49
        }
50
      while (token == CPP_COMMA);
51
    }
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.