OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [uninit-2.c] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
/* Spurious uninitialized variable warnings, case 2.
/* Spurious uninitialized variable warnings, case 2.
   Taken from cpphash.c (macroexpand) */
   Taken from cpphash.c (macroexpand) */
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "-O -Wuninitialized" } */
/* { dg-options "-O -Wuninitialized" } */
 
 
struct definition
struct definition
{
{
  int nargs;
  int nargs;
  int rest_args;
  int rest_args;
};
};
 
 
struct cpp_reader;
struct cpp_reader;
 
 
enum cpp_token
enum cpp_token
{
{
  CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN
  CPP_EOF, CPP_POP, CPP_COMMA, CPP_RPAREN
};
};
 
 
extern enum cpp_token macarg (struct cpp_reader *, int);
extern enum cpp_token macarg (struct cpp_reader *, int);
 
 
void
void
macroexpand (struct cpp_reader *pfile, struct definition *defn)
macroexpand (struct cpp_reader *pfile, struct definition *defn)
{
{
  int nargs = defn->nargs;
  int nargs = defn->nargs;
 
 
  if (nargs >= 0)
  if (nargs >= 0)
    {
    {
      enum cpp_token token;  /* { dg-bogus "token" "uninitialized variable warning" } */
      enum cpp_token token;  /* { dg-bogus "token" "uninitialized variable warning" } */
      int i, rest_args;
      int i, rest_args;
      i = 0;
      i = 0;
      rest_args = 0;
      rest_args = 0;
      do
      do
        {
        {
          if (rest_args)
          if (rest_args)
            continue;
            continue;
          if (i < nargs || (nargs == 0 && i == 0))
          if (i < nargs || (nargs == 0 && i == 0))
            {
            {
              /* if we are working on last arg which absorbs rest of args... */
              /* if we are working on last arg which absorbs rest of args... */
              if (i == nargs - 1 && defn->rest_args)
              if (i == nargs - 1 && defn->rest_args)
                rest_args = 1;
                rest_args = 1;
              token = macarg (pfile, rest_args);
              token = macarg (pfile, rest_args);
            }
            }
          else
          else
            token = macarg (pfile, 0);
            token = macarg (pfile, 0);
          if (token == CPP_EOF || token == CPP_POP)
          if (token == CPP_EOF || token == CPP_POP)
            return;
            return;
 
 
          i++;
          i++;
        }
        }
      while (token == CPP_COMMA);
      while (token == CPP_COMMA);
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

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