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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [Wswitch.c] - Blame information for rev 298

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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