aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/warn/do-empty.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/warn/do-empty.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/warn/do-empty.C15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/do-empty.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/do-empty.C
new file mode 100644
index 000000000..350261d48
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/do-empty.C
@@ -0,0 +1,15 @@
+/* Test diagnostics for empty bodies in do / while. */
+/* { dg-do compile } */
+/* { dg-options "-Wempty-body" } */
+
+void
+f (int x)
+{
+ do
+ ; /* { dg-warning "empty body in" } */
+ while (x--);
+
+ do
+ {} /* { dg-bogus "empty body in" } */
+ while (++x < 10);
+}