aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog12
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-25.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-26.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-27.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-30.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-31.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-32.c33
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-33.c33
10 files changed, 309 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0f20cd..4423684 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2016-10-12 Jakub Jelinek <jakub@redhat.com>
+
+ * c-c++-common/Wimplicit-fallthrough-25.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-26.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-27.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-28.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-29.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-30.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-31.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-32.c: New test.
+ * c-c++-common/Wimplicit-fallthrough-33.c: New test.
+
2016-10-11 Eric Botcazou <ebotcazou@adacore.com>
* gcc.target/sparc/setcc-4.c: Adjust.
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-25.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-25.c
new file mode 100644
index 0000000..f622878
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-25.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wextra" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-26.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-26.c
new file mode 100644
index 0000000..3c62de1
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-26.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-27.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-27.c
new file mode 100644
index 0000000..7ea0815
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-27.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=1" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c
new file mode 100644
index 0000000..7c685f6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=2" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c
new file mode 100644
index 0000000..9863e9d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=3" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-30.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-30.c
new file mode 100644
index 0000000..54d22df
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-30.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=4" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-31.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-31.c
new file mode 100644
index 0000000..de20d92
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-31.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=5" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-32.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-32.c
new file mode 100644
index 0000000..cd0b8ce
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-32.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=0" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-33.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-33.c
new file mode 100644
index 0000000..336cc44
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-33.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wno-implicit-fallthrough" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}