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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [Wswitch-default.c] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-Wswitch-default" } */
3
 
4
enum e { e1, e2 };
5
 
6
int
7
foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el,
8
     enum e em, enum e en, enum e eo, enum e ep)
9
{
10
  switch (i) /* { dg-warning "switch missing default case" } */
11
    {
12
    case 1: return 1;
13
    case 2: return 2;
14
    }
15
  switch (j)
16
    {
17
    case 3: return 4;
18
    case 4: return 3;
19
    default: break;
20
    }
21
  switch (ei) /* { dg-warning "switch missing default case" } */
22
    {
23
    }
24
  switch (ej)
25
    {
26
    default: break;
27
    }
28
  switch (ek) /* { dg-warning "switch missing default case" } */
29
    {
30
    case e1: return 1;
31
    }
32
  switch (el)
33
    {
34
    case e1: return 1;
35
    default: break;
36
    }
37
  switch (em) /* { dg-warning "switch missing default case" } */
38
    {
39
    case e1: return 1;
40
    case e2: return 2;
41
    }
42
  switch (en)
43
    {
44
    case e1: return 1;
45
    case e2: return 2;
46
    default: break;
47
    }
48
  switch (eo) /* { dg-warning "switch missing default case" } */
49
    {
50
    case e1: return 1;
51
    case e2: return 2;
52
    case 3: return 3;
53
    }
54
  switch (ep)
55
    {
56
    case e1: return 1;
57
    case e2: return 2;
58
    case 3: return 3;
59
    default: break;
60
    }
61
  return 0;
62
}

powered by: WebSVN 2.1.0

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