summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gcc.dg/declspec-18.c100
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/920923-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr44517.c2
-rw-r--r--gcc/testsuite/objc.dg/tls/init-2.m2
5 files changed, 113 insertions, 5 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 95ede64a181..7db98fc0a44 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2010-12-17 Paolo Bonzini <bonzini@gnu.org>
+
+ PR c/20385
+ * objc.dg/tls/init-2.m: Adjust.
+ * gcc.dg/noncompile/920923-1.c: Adjust.
+ * gcc.dg/noncompile/pr44517.c: Adjust.
+ * gcc.dg/declspec-18.c: New test.
+
2010-12-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* gcc.dg/titype-1.c: Enable TImode on __SPU__.
diff --git a/gcc/testsuite/gcc.dg/declspec-18.c b/gcc/testsuite/gcc.dg/declspec-18.c
new file mode 100644
index 00000000000..d29ff13732c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/declspec-18.c
@@ -0,0 +1,100 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu89" } */
+
+static t1 *a; /* { dg-error "unknown type name 't1'" } */
+
+int z; /* { dg-message "previous declaration of 'z'" } */
+typedef t2 *z; /* { dg-error "unknown type name 't2'" } */
+/* { dg-error "'z' redeclared " "" { target *-*-* } 7 } */
+
+extern t3 p1(void); /* { dg-error "unknown type name 't3'" } */
+int p2(const t4 x); /* { dg-error "unknown type name 't4'" } */
+int p3(const t1 x); /* { dg-error "unknown type name 't1'" } */ /* dup??? */
+int p4(t5 (*x)(void)); /* { dg-error "unknown type name 't5'" } */
+int p5(t6 *); /* { dg-error "unknown type name 't6'" } */
+int p6(t7 x); /* { dg-error "unknown type name 't7'" } */
+int p7(t8[]); /* { dg-error "unknown type name 't8'" } */
+int p8(int, t9); /* { dg-error "unknown type name 't9'" } */
+
+struct s {
+ const t1 a; /* { dg-error "unknown type name 't1'" } */ /* dup??? */
+ const t10 b; /* { dg-error "unknown type name 't10'" } */
+ int b; /* { dg-error "duplicate member" } */
+};
+
+typeof (z) c1;
+typeof (x1) c2; /* { dg-error "undeclared" } */
+typeof (const t11) c3; /* { dg-error "unknown type name 't11'" } */
+typeof (t12 *) c3; /* { dg-error "unknown type name 't12'" "" { xfail *-*-* } } */
+/* { dg-bogus "unknown type name 'x1'" "" { target *-*-* } 26 } */
+/* { dg-bogus "undeclared" "" { xfail *-*-* } 28 } */
+/* { dg-bogus "expected expression before" "" { xfail *-*-* } 28 } */
+
+int recover1;
+
+int s0 = sizeof (z);
+int s1 = sizeof (x2); /* { dg-error "undeclared" } */
+int s2 = sizeof (const t13); /* { dg-error "unknown type name 't13'" } */
+int s3 = sizeof (t14 *); /* { dg-error "unknown type name 't14'" "" { xfail *-*-* } } */
+
+int recover2;
+
+/* { dg-bogus "unknown type name 'x2'" "" { target *-*-* } 36 } */
+/* { dg-bogus "undeclared" "" { xfail *-*-* } 38 } */
+/* { dg-bogus "expected expression before" "" { xfail *-*-* } 38 } */
+
+int a0 = __alignof__ (z);
+int a1 = __alignof__ (x3); /* { dg-error "undeclared" } */
+int a2 = __alignof__ (const t15); /* { dg-error "unknown type name 't15'" } */
+int a3 = __alignof__ (t16 *); /* { dg-error "unknown type name 't16'" "" { xfail *-*-* } } */
+
+int recover3;
+
+/* { dg-bogus "unknown type name 'x3'" "" { target *-*-* } 47 } */
+/* { dg-bogus "undeclared" "" { xfail *-*-* } 49 } */
+/* { dg-bogus "expected expression before" "" { xfail *-*-* } 49 } */
+
+
+/* Cannot detect (undefd_type *) or (undefd_type (*) because it would
+ require 3 tokens of lookahead (same as above). */
+
+const char *f1()
+{
+ return (const t17) "abc"; /* { dg-error "unknown type name 't17'" } */
+/* { dg-bogus "expected" "" { target *-*-* } 63 } */
+}
+
+const char *f2()
+{
+ return (const t18 *) "abc"; /* { dg-error "unknown type name 't18'" } */
+/* { dg-bogus "expected" "" { target *-*-* } 69 } */
+}
+
+
+/* The parser has problems distinguishing semantic and syntactic errors,
+ so it emits a wrong "expected ')'" error here. */
+
+void *f3(int x)
+{
+ return (void *) ((void *(*)(t19)) f3); /* { dg-error "unknown type name 't19'" } */
+/* { dg-bogus "expected" "" { xfail *-*-* } 79 } */
+}
+
+const void *f4()
+{
+ return &((const t20){1}); /* { dg-error "unknown type name 't20'" } */
+/* { dg-bogus "return discards 'const'" "" { target *-*-* } 85 } */
+/* { dg-bogus "expected" "" { target *-*-* } 85 } */
+}
+
+int f5(__builtin_va_list ap)
+{
+ int x = __builtin_va_arg (ap, t21); /* { dg-error "unknown type name 't21'" } */
+ int y = __builtin_va_arg (ap, const t22); /* { dg-error "unknown type name 't22'" } */
+}
+
+int f6(void)
+{
+ return __builtin_offsetof (t23, field); /* { dg-error "unknown type name 't23'" } */
+/* { dg-bogus "request for member" "" { target *-*-* } 98 } */
+}
diff --git a/gcc/testsuite/gcc.dg/noncompile/920923-1.c b/gcc/testsuite/gcc.dg/noncompile/920923-1.c
index f586a7c0d04..ccd1dc3a782 100644
--- a/gcc/testsuite/gcc.dg/noncompile/920923-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/920923-1.c
@@ -2,13 +2,13 @@
typedef BYTE unsigned char; /* { dg-error "expected" } */
typedef int item_n;
typedef int perm_set;
-struct PENT { caddr_t v_addr; };/* { dg-error "expected" } */
+struct PENT { caddr_t v_addr; };/* { dg-error "unknown type name" } */
typedef struct PENT prec;
typedef struct PENT *prec_t;
prec_t mem_hash;
BYTE *mem_base; /* { dg-error "unknown type name" } */
struct PTE {
- BYTE *p_page; /* { dg-error "expected" } */
+ BYTE *p_page; /* { dg-error "unknown type name" } */
perm_set p_perms;
};
typedef struct PTE pte;
@@ -56,7 +56,7 @@ int va_op;
caddr_t v_addr; /* { dg-error "unknown type name" } */
{
register prec_t bucket;
- register caddr_t p_addr; /* { dg-error "expected|undeclared" } */
+ register caddr_t p_addr; /* { dg-error "unknown type name" } */
bucket = mem_hash+((((v_addr)>>ITEMBITS))&hash_mask); /* { dg-error "undeclared" } */
do {
if (bucket->v_addr == ((v_addr)>>ITEMBITS) { /* { dg-error "expected|undeclared|no member" } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr44517.c b/gcc/testsuite/gcc.dg/noncompile/pr44517.c
index 5977d68fef8..3a5148af83f 100644
--- a/gcc/testsuite/gcc.dg/noncompile/pr44517.c
+++ b/gcc/testsuite/gcc.dg/noncompile/pr44517.c
@@ -12,7 +12,7 @@ int f2(int x, lon y, long z, ...){ /* { dg-error "unknown type name 'lon'" } */
void f3(int n, int a[n], pid_t x); /* { dg-error "unknown type name 'pid_t'" } */
void f4() {}
void f5(int a, *b); /* { dg-error "expected declaration specifiers or" } */
-void f6(int a, b); /* { dg-error "expected declaration specifiers or" } */
+void f6(int a, b); /* { dg-error "unknown type name 'b'" } */
void f7(int a, goto b); /* { dg-error "expected declaration specifiers or" } */
void f8(int a, in goto); /* { dg-error "unknown type name 'in'" } */
void f9(int a, in 1); /* { dg-error "unknown type name 'in'" } */
diff --git a/gcc/testsuite/objc.dg/tls/init-2.m b/gcc/testsuite/objc.dg/tls/init-2.m
index 69733cc3c1c..882e5f80995 100644
--- a/gcc/testsuite/objc.dg/tls/init-2.m
+++ b/gcc/testsuite/objc.dg/tls/init-2.m
@@ -11,4 +11,4 @@ struct S
{
S(); /* { dg-error "expected specifier-qualifier-list before 'S'" } */
};
-__thread S s; /* { dg-error "expected" } two errors here */
+__thread S s; /* { dg-error "unknown type name" } */