summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorspark <spark@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-12 18:31:39 +0000
committerspark <spark@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-12 18:31:39 +0000
commitaaafd660d81d50e2b1f80bed091f280c85227d65 (patch)
treef58a0ea917a7250e26da70b4e2da5c2e6db2fd99 /gcc/testsuite/gcc.dg
parentcc2af1837d7bca898fa95e8eaa28d13b48c6e6fa (diff)
downloadgcc-aaafd660d81d50e2b1f80bed091f280c85227d65.tar.gz
ChangeLog:
2007-03-12 Seongbae Park <seongbae.park@gmail.com> * gcc/doc/invoke.texi (Wvla): New warning. gcc/ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * c-decl.c (warn_variable_length_array): New function. Refactored from grokdeclarator to handle warn_vla and handle unnamed array case. (grokdeclarator): Refactored VLA warning case. * c.opt (Wvla): New flag. gcc/cp/ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * decl.c (compute_array_index_type): New warning flag warn_vla. gcc/testsuite/ChangeLog: 2007-03-12 Seongbae Park <seongbae.park@gmail.com> * gcc.dg/wvla-1.c: New test * gcc.dg/wvla-2.c: New test * gcc.dg/wvla-3.c: New test * gcc.dg/wvla-4.c: New test * gcc.dg/wvla-5.c: New test * gcc.dg/wvla-6.c: New test * gcc.dg/wvla-7.c: New test * g++.dg/warn/Wvla-1.C: New test * g++.dg/warn/Wvla-2.C: New test * g++.dg/warn/Wvla-3.C: New test git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/wvla-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/wvla-2.c5
-rw-r--r--gcc/testsuite/gcc.dg/wvla-3.c5
-rw-r--r--gcc/testsuite/gcc.dg/wvla-4.c5
-rw-r--r--gcc/testsuite/gcc.dg/wvla-5.c5
-rw-r--r--gcc/testsuite/gcc.dg/wvla-6.c5
-rw-r--r--gcc/testsuite/gcc.dg/wvla-7.c5
7 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/wvla-1.c b/gcc/testsuite/gcc.dg/wvla-1.c
new file mode 100644
index 00000000000..c8f21078be9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-1.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c89 -Wvla" } */
+
+extern void
+func (int i, int array[i]); /* { dg-warning "variable length array 'array' is used" } */
diff --git a/gcc/testsuite/gcc.dg/wvla-2.c b/gcc/testsuite/gcc.dg/wvla-2.c
new file mode 100644
index 00000000000..d811a112f07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-2.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c99 -Wvla" } */
+
+extern void
+func (int i, int array[i]); /* { dg-warning "variable length array 'array' is used" } */
diff --git a/gcc/testsuite/gcc.dg/wvla-3.c b/gcc/testsuite/gcc.dg/wvla-3.c
new file mode 100644
index 00000000000..3d5d3aa5434
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-3.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -std=c89 -Wvla" } */
+
+extern void
+func (int i, int array[i]); /* { dg-error "error: ISO C90 forbids variable.* array 'array'" } */
diff --git a/gcc/testsuite/gcc.dg/wvla-4.c b/gcc/testsuite/gcc.dg/wvla-4.c
new file mode 100644
index 00000000000..8c15292edac
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-4.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -std=c99 -Wvla" } */
+
+extern void
+func (int i, int array[i]); /* { dg-warning "variable length array 'array' is used" } */
diff --git a/gcc/testsuite/gcc.dg/wvla-5.c b/gcc/testsuite/gcc.dg/wvla-5.c
new file mode 100644
index 00000000000..919b8dc201b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-5.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -std=c89 -Wno-vla" } */
+
+extern void
+func (int i, int array[i]);
diff --git a/gcc/testsuite/gcc.dg/wvla-6.c b/gcc/testsuite/gcc.dg/wvla-6.c
new file mode 100644
index 00000000000..f21435b02a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-6.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-std=c89 -Wvla" } */
+
+extern void
+func (int i, int [i]); /* { dg-warning "variable length array is used" } */
diff --git a/gcc/testsuite/gcc.dg/wvla-7.c b/gcc/testsuite/gcc.dg/wvla-7.c
new file mode 100644
index 00000000000..bc113bfb05d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/wvla-7.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -std=c89 -Wvla" } */
+
+extern void
+func (int i, int [i]); /* { dg-error "error: ISO C90 forbids variable" } */