summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-08 04:00:50 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-08 04:00:50 +0000
commit561017b56be056393775e0713919a4f8c6210daf (patch)
tree4bd535229794d01698a0f16070f3eb455edc1fcf /gcc/testsuite/g++.dg
parentf0d7717d41b309917bd4b33b7ab68db223c737aa (diff)
downloadgcc-561017b56be056393775e0713919a4f8c6210daf.tar.gz
./:
* dwarf2.h (enum dwarf_location_atom): Add INTERNAL_DW_OP_tls_addr. * dwarf2out.c (INTERNAL_DW_OP_tls_addr): Don't #define. * c-common.c (c_do_switch_warnings): Don't exit early for -Wswitch with no default node. Change warning with %H to warning_at. Don't clear warn_switch around case checking. * doc/invoke.texi (Warning Options): Clarify distinction between -Wswitch and -Wswitch-enum. java/: * jcf-parse.c (handle_constant): Change local variable 'kind' to unsigned int. testsuite/: * g++.dg/warn/Wswitch-3.C: New testcase. * gcc.dg/Wswitch.c: Adjust for -Wswitch change. * gcc.dg/Wswitch-enum-error.c: Likewise. * gcc.dg/Wswitch-error.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148270 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/warn/Wswitch-3.C37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wswitch-3.C b/gcc/testsuite/g++.dg/warn/Wswitch-3.C
new file mode 100644
index 00000000000..df1f8956dad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wswitch-3.C
@@ -0,0 +1,37 @@
+/* { dg-do compile } */
+/* { dg-options "-Wswitch" } */
+
+enum E { A, B, C, D, E, F };
+
+int
+f1 (enum E e)
+{
+ switch (e)
+ {
+ case A: return 1;
+ case B: return 2;
+ case C: return 3;
+ case D: return 4;
+ case E: return 5;
+ case F: return 6;
+ case 7: return 7; /* { dg-warning "not in enumerated type" } */
+ }
+ return 0;
+}
+
+int
+f2 (enum E e)
+{
+ switch (e)
+ {
+ case A: return 1;
+ case B: return 2;
+ case C: return 3;
+ case D: return 4;
+ case E: return 5;
+ case F: return 6;
+ case 7: return 7; /* { dg-warning "not in enumerated type" } */
+ default: return 8;
+ }
+ return 0;
+}