c-simplify.c (simplify_switch_stmt): A SWITCH_EXPR also gets the source location of its first line.

* c-simplify.c (simplify_switch_stmt): A SWITCH_EXPR also gets the
        source location of its first line.

From-SVN: r67188
This commit is contained in:
Jason Merrill 2003-05-27 12:09:28 -04:00
parent 0f35d19264
commit 86982c71d1
2 changed files with 10 additions and 10 deletions

View file

@ -20,16 +20,16 @@ foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el,
default: break;
}
switch (ei)
{ /* { dg-warning "enumeration value `e1' not handled in switch" "enum e1" { target *-*-* } 24 } */
} /* { dg-warning "enumeration value `e2' not handled in switch" "enum e2" } */
{ /* { dg-warning "enumeration value `e1' not handled in switch" "enum e1" } */
} /* { dg-warning "enumeration value `e2' not handled in switch" "enum e2" { target *-*-* } 23 } */
switch (ej)
{
default: break;
}
switch (ek)
switch (ek) /* { dg-warning "enumeration value `e2' not handled in switch" "enum e2" } */
{
case e1: return 1;
} /* { dg-warning "enumeration value `e2' not handled in switch" "enum e2" } */
}
switch (el)
{
case e1: return 1;
@ -46,12 +46,12 @@ foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el,
case e2: return 2;
default: break;
}
switch (eo)
switch (eo) /* { dg-warning "case value `3' not in enumerated type `e'" "excess 3" } */
{
case e1: return 1;
case e2: return 2;
case 3: return 3;
} /* { dg-warning "case value `3' not in enumerated type `e'" "excess 3" } */
}
switch (ep)
{
case e1: return 1;

View file

@ -13,19 +13,19 @@ foo (enum e ei, int j)
case e3: return 2;
case e4: return 3;
} /* No warning here since e2 has the same value as e3. */
switch (ei)
switch (ei) /* { dg-warning "enumeration value `e4' not handled in switch" "enum e4" } */
{
case e1: return 1;
case e2: return 2;
} /* { dg-warning "enumeration value `e4' not handled in switch" "enum e4" } */
}
switch ((int) ei)
{
case e1: return 1;
} /* No warning here since switch condition was cast to int. */
switch ((enum e) j)
switch ((enum e) j) /* { dg-warning "enumeration value `e1' not handled in switch" "enum e1" } */
{
case e2: return 1;
case e4: return 2;
} /* { dg-warning "enumeration value `e1' not handled in switch" "enum e1" } */
}
return 0;
}