aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c
new file mode 100644
index 000000000..2036d82fb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/c99-arraydecl-1.c
@@ -0,0 +1,111 @@
+/* Test for C99 forms of array declarator. */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+/* Because GCC doesn't yet implement it, we don't yet test for [*] here. */
+
+/* Test each of: [quals], [quals expr], [static expr], [static quals expr],
+ [quals static expr]. Not yet: [quals *]. */
+
+void f00 (int a[const]);
+void f01 (int [const]);
+
+void
+f02 (int a[const])
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 17 } */
+ int *const *c = &a;
+}
+void
+f03 (a)
+ int a[const];
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 25 } */
+ int *const *c = &a;
+}
+
+void f10 (int a[const 2]);
+void f11 (int [const 2]);
+
+void
+f12 (int a[const 2])
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 36 } */
+ int *const *c = &a;
+}
+void
+f13 (a)
+ int a[const 2];
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 44 } */
+ int *const *c = &a;
+}
+
+void f20 (int a[static 2]);
+void f21 (int [static 2]);
+
+void
+f22 (int a[static 2])
+{
+ int **b = &a;
+ int *const *c = &a;
+}
+void
+f23 (a)
+ int a[static 2];
+{
+ int **b = &a;
+ int *const *c = &a;
+}
+
+void f30 (int a[static const 2]);
+void f31 (int [static const 2]);
+
+void
+f32 (int a[static const 2])
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 72 } */
+ int *const *c = &a;
+}
+void
+f33 (a)
+ int a[static const 2];
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 80 } */
+ int *const *c = &a;
+}
+
+void f40 (int a[const static 2]);
+void f41 (int [const static 2]);
+
+void
+f42 (int a[const static 2])
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 91 } */
+ int *const *c = &a;
+}
+void
+f43 (a)
+ int a[const static 2];
+{
+ int **b = &a; /* { dg-bogus "warning" "warning in place of error" } */
+ /* { dg-error "discards" "discards quals" { target *-*-* } 99 } */
+ int *const *c = &a;
+}
+
+/* Test rejection of static and type qualifiers in non-parameter contexts. */
+int x[const 2]; /* { dg-bogus "warning" "warning in place of error" } */
+/* { dg-error "non-parameter" "quals in non-parm array" { target *-*-* } 105 } */
+int y[static 2]; /* { dg-bogus "warning" "warning in place of error" } */
+/* { dg-error "non-parameter" "static in non-parm array" { target *-*-* } 107 } */
+void g (int a[static 2][3]);
+void h (int a[2][static 3]); /* { dg-bogus "warning" "warning in place of error" } */
+/* { dg-error "non-parameter" "static in non-final parm array" { target *-*-* } 110 } */