From: Jason Merrill Date: Tue, 27 May 2003 16:09:28 +0000 (-0400) Subject: c-simplify.c (simplify_switch_stmt): A SWITCH_EXPR also gets the source location... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86982c71d17f2e9888e649fe5c88b65ff84561d8;p=gcc.git 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 --- diff --git a/gcc/testsuite/g++.dg/warn/Wswitch-1.C b/gcc/testsuite/g++.dg/warn/Wswitch-1.C index e9fcb581817..5c68b026dcf 100644 --- a/gcc/testsuite/g++.dg/warn/Wswitch-1.C +++ b/gcc/testsuite/g++.dg/warn/Wswitch-1.C @@ -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; diff --git a/gcc/testsuite/g++.dg/warn/Wswitch-2.C b/gcc/testsuite/g++.dg/warn/Wswitch-2.C index b151e2310c7..9bc7d022b46 100644 --- a/gcc/testsuite/g++.dg/warn/Wswitch-2.C +++ b/gcc/testsuite/g++.dg/warn/Wswitch-2.C @@ -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; }