aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/do-empty.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/do-empty.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/do-empty.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/do-empty.c b/gcc-4.9/gcc/testsuite/gcc.dg/do-empty.c
new file mode 100644
index 000000000..350261d48
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/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);
+}