summaryrefslogtreecommitdiffstats
path: root/test/Parser
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser')
-rwxr-xr-xtest/Parser/2008-10-31-parse-noop-failure.c4
-rw-r--r--test/Parser/MicrosoftExtensions.c4
-rw-r--r--test/Parser/asm-constraints-pr7869.c45
-rw-r--r--test/Parser/asm.c3
-rw-r--r--test/Parser/block-block-storageclass.c4
-rw-r--r--test/Parser/block-pointer-decl.c4
-rw-r--r--test/Parser/cxx-altivec.cpp35
-rw-r--r--test/Parser/cxx-ambig-decl-expr-xfail.cpp16
-rw-r--r--test/Parser/cxx-ambig-decl-expr.cpp10
-rw-r--r--test/Parser/cxx-attributes.cpp18
-rw-r--r--test/Parser/cxx-condition.cpp4
-rw-r--r--test/Parser/cxx-decl.cpp7
-rw-r--r--test/Parser/cxx-default-args.cpp7
-rw-r--r--test/Parser/cxx-namespace-alias.cpp7
-rw-r--r--test/Parser/cxx-typeof.cpp6
-rw-r--r--test/Parser/declarators.c3
-rw-r--r--test/Parser/expressions.c30
-rw-r--r--test/Parser/expressions.m2
-rw-r--r--test/Parser/method-prototype-1.m2
-rw-r--r--test/Parser/objc-messaging-1.m27
-rw-r--r--test/Parser/pragma-options.c10
-rw-r--r--test/Parser/pragma-visibility.c9
-rw-r--r--test/Parser/selector-1.m2
-rw-r--r--test/Parser/typeof.c7
-rw-r--r--test/Parser/types.c2
25 files changed, 216 insertions, 52 deletions
diff --git a/test/Parser/2008-10-31-parse-noop-failure.c b/test/Parser/2008-10-31-parse-noop-failure.c
deleted file mode 100755
index 6df508e..0000000
--- a/test/Parser/2008-10-31-parse-noop-failure.c
+++ /dev/null
@@ -1,4 +0,0 @@
-// RUN: %clang_cc1 -verify -parse-noop %s
-
-void add_attribute(id) int id; {}
-
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 0b2733e..ec272cd 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -1,8 +1,9 @@
-// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -x objective-c++ %s
+// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s
__stdcall int func0();
int __stdcall func();
typedef int (__cdecl *tptr)();
void (*__fastcall fastpfunc)();
+struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {};
extern __declspec(dllimport) void __stdcall VarR4FromDec();
__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix);
__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory );
@@ -34,3 +35,4 @@ typedef bool (__stdcall __stdcall *blarg)(int);
#define FOO(x) #@x
char x = FOO(a);
+typedef enum E { e1 };
diff --git a/test/Parser/asm-constraints-pr7869.c b/test/Parser/asm-constraints-pr7869.c
new file mode 100644
index 0000000..d6f1725
--- /dev/null
+++ b/test/Parser/asm-constraints-pr7869.c
@@ -0,0 +1,45 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+int a, b, c, d, e, f, g, h, i, j, k, l;
+
+void
+f1 (void)
+{
+ __asm__ volatile (""
+ : [a] "+r" (a), [b] "+r" (b), [c] "+r" (c), [d] "+r" (d),
+ [e] "+r" (e), [f] "+r" (f), [g] "+r" (g), [h] "+r" (h),
+ [i] "+r" (i), [j] "+r" (j), [k] "+r" (k), [l] "+r" (l));
+}
+
+void
+f2 (void)
+{
+ __asm__ volatile (""
+ : [a] "+r,m" (a), [b] "+r,m" (b), [c] "+r,m" (c), [d] "+r,m" (d),
+ [e] "+r,m" (e), [f] "+r,m" (f), [g] "+r,m" (g), [h] "+r,m" (h),
+ [i] "+r,m" (i), [j] "+r,m" (j), [k] "+r,m" (k), [l] "+r,m" (l));
+}
+
+void
+f3 (void)
+{
+ __asm__ volatile (""
+ : [a] "=r" (a), [b] "=r" (b), [c] "=r" (c), [d] "=r" (d),
+ [e] "=r" (e), [f] "=r" (f), [g] "=r" (g), [h] "=r" (h),
+ [i] "=r" (i), [j] "=r" (j), [k] "=r" (k), [l] "=r" (l)
+ : "[a]" (a), "[b]" (b), "[c]" (c), "[d]" (d),
+ "[e]" (e), "[f]" (f), "[g]" (g), "[h]" (h),
+ "[i]" (i), "[j]" (j), "[k]" (k), "[l]" (l));
+}
+
+void
+f4 (void)
+{
+ __asm__ volatile (""
+ : [a] "=r,m" (a), [b] "=r,m" (b), [c] "=r,m" (c), [d] "=r,m" (d),
+ [e] "=r,m" (e), [f] "=r,m" (f), [g] "=r,m" (g), [h] "=r,m" (h),
+ [i] "=r,m" (i), [j] "=r,m" (j), [k] "=r,m" (k), [l] "=r,m" (l)
+ : "[a],m" (a), "[b],m" (b), "[c],m" (c), "[d],m" (d),
+ "[e],m" (e), "[f],m" (f), "[g],m" (g), "[h],m" (h),
+ "[i],m" (i), "[j],m" (j), "[k],m" (k), "[l],m" (l));
+}
diff --git a/test/Parser/asm.c b/test/Parser/asm.c
index df2e16f..9081826 100644
--- a/test/Parser/asm.c
+++ b/test/Parser/asm.c
@@ -1,7 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
void f1() {
- asm ("ret" : : :); // expected-error {{expected string literal}}
+ // PR7673: Some versions of GCC support an empty clobbers section.
+ asm ("ret" : : :);
}
void f2() {
diff --git a/test/Parser/block-block-storageclass.c b/test/Parser/block-block-storageclass.c
index a4efc44..97ba113 100644
--- a/test/Parser/block-block-storageclass.c
+++ b/test/Parser/block-block-storageclass.c
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -parse-noop %s
-#if 0
+// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s
int printf(const char *, ...);
void _Block_byref_release(void*src){}
@@ -16,4 +15,3 @@ int main() {
return X;
}
-#endif
diff --git a/test/Parser/block-pointer-decl.c b/test/Parser/block-pointer-decl.c
index 2979b01..a8cc258 100644
--- a/test/Parser/block-pointer-decl.c
+++ b/test/Parser/block-pointer-decl.c
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -parse-noop -fblocks %s
+// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s
+
+int printf(char const *, ...);
struct blockStruct {
int (^a)(float, int);
diff --git a/test/Parser/cxx-altivec.cpp b/test/Parser/cxx-altivec.cpp
index a70eea0..8f46330 100644
--- a/test/Parser/cxx-altivec.cpp
+++ b/test/Parser/cxx-altivec.cpp
@@ -126,3 +126,38 @@ vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd'));
vector int v4 = (vector int)(1, 2, 3, 4);
vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3)));
+
+#if 0 // Not ready yet.
+// bug 7553 - Problem with '==' and vectors
+void func() {
+ vector int v10i = (vector int)(1, 2, 3, 4);
+ vector int v11i = (vector int)(1, 2, 3, 4);
+ bool r10ieq = (v10i == v11i);
+ bool r10ine = (v10i != v11i);
+ bool r10igt = (v10i > v11i);
+ bool r10ige = (v10i >= v11i);
+ bool r10ilt = (v10i < v11i);
+ bool r10ile = (v10i <= v11i);
+ vector float v10f = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
+ vector float v11f = (vector float)(1.0f, 2.0f, 3.0f, 4.0f);
+ bool r10feq = (v10f == v11f);
+ bool r10fne = (v10f != v11f);
+ bool r10fgt = (v10f > v11f);
+ bool r10fge = (v10f >= v11f);
+ bool r10flt = (v10f < v11f);
+ bool r10fle = (v10f <= v11f);
+}
+#endif
+
+// vecreturn attribute test
+struct Vector
+{
+ __vector float xyzw;
+} __attribute__((vecreturn));
+
+Vector Add(Vector lhs, Vector rhs)
+{
+ Vector result;
+ result.xyzw = vec_add(lhs.xyzw, rhs.xyzw);
+ return result; // This will (eventually) be returned in a register
+}
diff --git a/test/Parser/cxx-ambig-decl-expr-xfail.cpp b/test/Parser/cxx-ambig-decl-expr-xfail.cpp
new file mode 100644
index 0000000..ac4accb
--- /dev/null
+++ b/test/Parser/cxx-ambig-decl-expr-xfail.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// XFAIL: *
+struct X {
+ template<typename T> X(T);
+ X(int, int);
+
+ X operator()(int, int) const;
+};
+
+template<typename T, typename U> struct Y { };
+
+X *x;
+void f() {
+ int y = 0;
+ X (*x)(int(y), int(y)) = Y<int, float>(), ++y;
+}
diff --git a/test/Parser/cxx-ambig-decl-expr.cpp b/test/Parser/cxx-ambig-decl-expr.cpp
new file mode 100644
index 0000000..b5ff728
--- /dev/null
+++ b/test/Parser/cxx-ambig-decl-expr.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+struct X {
+ template<typename T, typename U>
+ static void f(int, int);
+};
+
+void f() {
+ void (*ptr)(int, int) = &X::f<int, int>;
+}
diff --git a/test/Parser/cxx-attributes.cpp b/test/Parser/cxx-attributes.cpp
index 192193a..8603b30 100644
--- a/test/Parser/cxx-attributes.cpp
+++ b/test/Parser/cxx-attributes.cpp
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-
-class c {
- virtual void f1(const char* a, ...)
- __attribute__ (( __format__(__printf__,2,3) )) = 0;
- virtual void f2(const char* a, ...)
- __attribute__ (( __format__(__printf__,2,3) )) {}
-};
-
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+class c {
+ virtual void f1(const char* a, ...)
+ __attribute__ (( __format__(__printf__,2,3) )) = 0;
+ virtual void f2(const char* a, ...)
+ __attribute__ (( __format__(__printf__,2,3) )) {}
+};
+
diff --git a/test/Parser/cxx-condition.cpp b/test/Parser/cxx-condition.cpp
index a3991c4..552d823 100644
--- a/test/Parser/cxx-condition.cpp
+++ b/test/Parser/cxx-condition.cpp
@@ -1,11 +1,11 @@
-// RUN: %clang_cc1 -parse-noop -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void f() {
int a;
while (a) ;
while (int x) ; // expected-error {{expected '=' after declarator}}
while (float x = 0) ;
- if (const int x = a) ;
+ if (const int x = a) ; // expected-warning{{empty body}}
switch (int x = a+10) {}
for (; int x = ++a; ) ;
}
diff --git a/test/Parser/cxx-decl.cpp b/test/Parser/cxx-decl.cpp
index e4c703c..e00ffd0 100644
--- a/test/Parser/cxx-decl.cpp
+++ b/test/Parser/cxx-decl.cpp
@@ -76,3 +76,10 @@ class Class2 {
} // no ;
typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
+
+// rdar : // 8307865
+struct CodeCompleteConsumer {
+};
+
+void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
+}
diff --git a/test/Parser/cxx-default-args.cpp b/test/Parser/cxx-default-args.cpp
index a084fb0..7fe8474 100644
--- a/test/Parser/cxx-default-args.cpp
+++ b/test/Parser/cxx-default-args.cpp
@@ -7,3 +7,10 @@ class C {
void m(int x = undecl + 0); // expected-error {{use of undeclared identifier 'undecl'}}
};
+typedef struct Inst {
+ void m(int x=0);
+} *InstPtr;
+
+struct X {
+ void f(int x = 1:); // expected-error {{unexpected end of default argument expression}}
+};
diff --git a/test/Parser/cxx-namespace-alias.cpp b/test/Parser/cxx-namespace-alias.cpp
index 2e4d7af..9b90aab 100644
--- a/test/Parser/cxx-namespace-alias.cpp
+++ b/test/Parser/cxx-namespace-alias.cpp
@@ -1,8 +1,9 @@
-// RUN: %clang_cc1 -parse-noop -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
-namespace A = B;
+namespace A = B; // expected-error{{namespace name}}
namespace A = !; // expected-error {{expected namespace name}}
-namespace A = A::!; // expected-error {{expected namespace name}}
+namespace A = A::!; // expected-error {{expected namespace name}} \
+ // expected-error{{use of undeclared identifier 'A'}}
diff --git a/test/Parser/cxx-typeof.cpp b/test/Parser/cxx-typeof.cpp
index 7e89101..4c598e9 100644
--- a/test/Parser/cxx-typeof.cpp
+++ b/test/Parser/cxx-typeof.cpp
@@ -5,3 +5,9 @@ static void test() {
int x;
typeof pi[x] y;
}
+
+// Part of rdar://problem/8347416; from the gcc test suite.
+struct S {
+ int i;
+ __typeof(S::i) foo(); // expected-error {{invalid use of nonstatic data member 'i'}}
+};
diff --git a/test/Parser/declarators.c b/test/Parser/declarators.c
index fb69fa9..e245adb 100644
--- a/test/Parser/declarators.c
+++ b/test/Parser/declarators.c
@@ -94,3 +94,6 @@ void test14() // expected-error {{expected ';' after top level declarator}}
void test14a();
void *test14b = (void*)test14a; // Make sure test14a didn't get skipped.
+
+// rdar://problem/8358508
+long struct X { int x; } test15(); // expected-error {{'long struct' is invalid}}
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index 44ebe66..ffc5c83 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -1,19 +1,17 @@
-// RUN: %clang_cc1 -parse-noop -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test1() {
- if (sizeof (int){ 1}); // sizeof compound literal
- if (sizeof (int)); // sizeof type
+ if (sizeof (int){ 1}) {} // sizeof compound literal
+ if (sizeof (int)) {} // sizeof type
- (int)4; // cast.
- (int){4}; // compound literal.
+ (void)(int)4; // cast.
+ (void)(int){4}; // compound literal.
- // FIXME: change this to the struct version when we can.
- //int A = (struct{ int a;}){ 1}.a;
- int A = (int){ 1}.a;
+ int A = (struct{ int a;}){ 1}.a;
}
int test2(int a, int b) {
- return a ? a,b : a;
+ return a ? (void)a,b : a;
}
int test3(int a, int b, int c) {
@@ -22,23 +20,27 @@ int test3(int a, int b, int c) {
int test4() {
test4();
+ return 0;
}
+struct X0 { struct { struct { int c[10][9]; } b; } a; };
+
int test_offsetof() {
- // FIXME: change into something that is semantically correct.
- __builtin_offsetof(int, a.b.c[4][5]);
+ (void)__builtin_offsetof(struct X0, a.b.c[4][5]);
+ return 0;
}
void test_sizeof(){
int arr[10];
- sizeof arr[0];
- sizeof(arr[0]);
- sizeof(arr)[0];
+ (void)sizeof arr[0];
+ (void)sizeof(arr[0]);
+ (void)sizeof(arr)[0];
}
// PR3418
int test_leading_extension() {
__extension__ (*(char*)0) = 1;
+ return 0;
}
// PR3972
diff --git a/test/Parser/expressions.m b/test/Parser/expressions.m
index e27f405..1f1005a 100644
--- a/test/Parser/expressions.m
+++ b/test/Parser/expressions.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -parse-noop %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
void test1() {
@"s"; // expected-warning {{expression result unused}}
diff --git a/test/Parser/method-prototype-1.m b/test/Parser/method-prototype-1.m
index d2d9563..a32bc2e 100644
--- a/test/Parser/method-prototype-1.m
+++ b/test/Parser/method-prototype-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -parse-noop
+// RUN: %clang_cc1 %s -fsyntax-only
@interface MyObject
- (void) bycopy : (int) woodo, ... ;
- (void) break : (int) woodo, ... ;
diff --git a/test/Parser/objc-messaging-1.m b/test/Parser/objc-messaging-1.m
index 511290e..82450df 100644
--- a/test/Parser/objc-messaging-1.m
+++ b/test/Parser/objc-messaging-1.m
@@ -1,19 +1,26 @@
-// RUN: %clang_cc1 %s -parse-noop
+// RUN: %clang_cc1 %s -fsyntax-only -verify
int main ()
{
int i,j;
struct S *p;
id a, b, c;
- [p ii];
- [p if: 1 :2];
- [p inout: 1 :2 another:(2,3,4)];
- [p inout: 1 :2 another:(2,3,4), 6,6,8];
- [p inout: 1 :2 another:(2,3,4), (6,4,5),6,8];
- [p inout: 1 :2 another:(i+10), (i,j-1,5),6,8];
- [p long: 1 :2 another:(i+10), (i,j-1,5),6,8];
- [p : "Hello\n" :2 another:(i+10), (i,j-1,5),6,8];
+ [a ii]; // expected-warning{{not found}}
+ [a if: 1 :2]; // expected-warning{{not found}}
+ [a inout: 1 :2 another:(2,3,4)]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a inout: 1 :2 another:(2,3,4), 6,6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a inout: 1 :2 another:(2,3,4), (6,4,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 4{{expression result unused}}
+ [a inout: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a long: 1 :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
+ [a : "Hello\n" :2 another:(i+10), (i,j-1,5),6,8]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
// Comma expression as receiver (rdar://6222856)
- [a, b, c foo];
+ [a, b, c foo]; // expected-warning{{not found}} \
+ // expected-warning 2{{expression result unused}}
}
diff --git a/test/Parser/pragma-options.c b/test/Parser/pragma-options.c
index daf385d..7844e71 100644
--- a/test/Parser/pragma-options.c
+++ b/test/Parser/pragma-options.c
@@ -10,3 +10,13 @@
#pragma options align=reset
#pragma options align=mac68k
#pragma options align=power
+
+/* expected-warning {{expected '=' following '#pragma align'}} */ #pragma align
+/* expected-warning {{expected identifier in '#pragma align'}} */ #pragma align =
+/* expected-warning {{invalid alignment option in '#pragma align'}} */ #pragma align = foo
+/* expected-warning {{extra tokens at end of '#pragma align'}} */ #pragma align = reset foo
+
+#pragma align=natural
+#pragma align=reset
+#pragma align=mac68k
+#pragma align=power
diff --git a/test/Parser/pragma-visibility.c b/test/Parser/pragma-visibility.c
new file mode 100644
index 0000000..cfc3d9e
--- /dev/null
+++ b/test/Parser/pragma-visibility.c
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#pragma GCC visibility foo // expected-warning{{expected identifier in '#pragma visibility' - ignored}}
+#pragma GCC visibility pop foo // expected-warning{{extra tokens at end of '#pragma visibility' - ignored}}
+#pragma GCC visibility push // expected-warning{{missing '(' after '#pragma visibility'}}
+#pragma GCC visibility push( // expected-warning{{expected identifier in '#pragma visibility' - ignored}}
+#pragma GCC visibility push(hidden // expected-warning{{missing ')' after '#pragma visibility' - ignoring}}
+#pragma GCC visibility push(hidden)
+#pragma GCC visibility pop
diff --git a/test/Parser/selector-1.m b/test/Parser/selector-1.m
index 1f9cad6..0f35ce7 100644
--- a/test/Parser/selector-1.m
+++ b/test/Parser/selector-1.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -parse-noop %s
+// RUN: %clang_cc1 -fsyntax-only -verify %s
int main() {
SEL s = @selector(retain);
diff --git a/test/Parser/typeof.c b/test/Parser/typeof.c
index cf0e47a..7953a69 100644
--- a/test/Parser/typeof.c
+++ b/test/Parser/typeof.c
@@ -17,3 +17,10 @@ static void test() {
int xx;
int *i;
}
+
+// <rdar://problem/8237491>
+void test2() {
+ int a;
+ short b;
+ __typeof__(a) (*f)(__typeof__(b));
+}
diff --git a/test/Parser/types.c b/test/Parser/types.c
index 0e8a63d..53b9dd5 100644
--- a/test/Parser/types.c
+++ b/test/Parser/types.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -parse-noop
+// RUN: %clang_cc1 %s -fsyntax-only -verify
// Test the X can be overloaded inside the struct.
typedef int X;
OpenPOWER on IntegriCloud