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/] [Wswitch-default.c] - Rev 154

Compare with Previous | Blame | View Log

/* { dg-do compile } */
/* { dg-options "-Wswitch-default" } */
 
enum e { e1, e2 };
 
int
foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el,
     enum e em, enum e en, enum e eo, enum e ep)
{
  switch (i) /* { dg-warning "switch missing default case" } */
    {
    case 1: return 1;
    case 2: return 2;
    }
  switch (j)
    {
    case 3: return 4;
    case 4: return 3;
    default: break;
    }
  switch (ei) /* { dg-warning "switch missing default case" } */
    {
    }
  switch (ej)
    {
    default: break;
    }
  switch (ek) /* { dg-warning "switch missing default case" } */
    {
    case e1: return 1;
    }
  switch (el)
    {
    case e1: return 1;
    default: break;
    }
  switch (em) /* { dg-warning "switch missing default case" } */
    {
    case e1: return 1;
    case e2: return 2;
    }
  switch (en)
    {
    case e1: return 1;
    case e2: return 2;
    default: break;
    }
  switch (eo) /* { dg-warning "switch missing default case" } */
    {
    case e1: return 1;
    case e2: return 2;
    case 3: return 3;
    }
  switch (ep)
    {
    case e1: return 1;
    case e2: return 2;
    case 3: return 3;
    default: break;
    }
  return 0;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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