aboutsummaryrefslogtreecommitdiff
path: root/test/Frontend
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-12-02 13:20:44 +0000
commit13cc256e404620c1de0cbcc4e43ce1e2dbbc4898 (patch)
tree2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Frontend
parent657bc3d9848e3be92029b2416031340988cd0111 (diff)
downloadsrc-13cc256e404620c1de0cbcc4e43ce1e2dbbc4898.tar.gz
src-13cc256e404620c1de0cbcc4e43ce1e2dbbc4898.zip
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):vendor/clang/clang-release_32-r168974
Notes
Notes: svn path=/vendor/clang/dist/; revision=243791 svn path=/vendor/clang/clang-release_32-r168974/; revision=243792; tag=vendor/clang/clang-release_32-r168974
Diffstat (limited to 'test/Frontend')
-rw-r--r--test/Frontend/ast-codegen.c4
-rw-r--r--test/Frontend/iframework.c3
-rw-r--r--test/Frontend/macros.c9
-rw-r--r--test/Frontend/unknown-pragmas.c1
-rw-r--r--test/Frontend/verify.c7
-rw-r--r--test/Frontend/verify2.c7
-rw-r--r--test/Frontend/verify3.c41
-rw-r--r--test/Frontend/warning-mapping-1.c1
-rw-r--r--test/Frontend/warning-mapping-4.c1
9 files changed, 65 insertions, 9 deletions
diff --git a/test/Frontend/ast-codegen.c b/test/Frontend/ast-codegen.c
index b5b2157e21ae..b85c5dcf5085 100644
--- a/test/Frontend/ast-codegen.c
+++ b/test/Frontend/ast-codegen.c
@@ -1,5 +1,5 @@
-// RUN: %clang -emit-ast -o %t.ast %s
-// RUN: %clang -emit-llvm -S -o - %t.ast | FileCheck %s
+// RUN: %clang -target i386-unknown-unknown -emit-ast -o %t.ast %s
+// RUN: %clang -target i386-unknown-unknown -emit-llvm -S -o - %t.ast | FileCheck %s
// CHECK: module asm "foo"
__asm__("foo");
diff --git a/test/Frontend/iframework.c b/test/Frontend/iframework.c
index 0c241fd4891c..6f801f2437a2 100644
--- a/test/Frontend/iframework.c
+++ b/test/Frontend/iframework.c
@@ -1,3 +1,4 @@
-// RUN: %clang -fsyntax-only -iframework%S/Inputs %s -Xclang -verify
+// RUN: %clang -fsyntax-only -iframework %S/Inputs %s -Xclang -verify
+// expected-no-diagnostics
#include <TestFramework/TestFramework.h>
diff --git a/test/Frontend/macros.c b/test/Frontend/macros.c
index 317079709c63..68f220339dbf 100644
--- a/test/Frontend/macros.c
+++ b/test/Frontend/macros.c
@@ -1,4 +1,13 @@
// RUN: %clang_cc1 -DA= -DB=1 -verify -fsyntax-only %s
+// expected-no-diagnostics
int a[(B A) == 1 ? 1 : -1];
+
+// PR13747 - Don't warn about unused results with statement exprs in macros.
+void stuff(int,int,int);
+#define memset(x,y,z) ({ stuff(x,y,z); x; })
+
+void foo(int a, int b, int c) {
+ memset(a,b,c); // No warning!
+}
diff --git a/test/Frontend/unknown-pragmas.c b/test/Frontend/unknown-pragmas.c
index 53a5a45a4337..eea025ceeea9 100644
--- a/test/Frontend/unknown-pragmas.c
+++ b/test/Frontend/unknown-pragmas.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -Eonly -Wall -verify %s
// RUN: %clang_cc1 -E -dM -Wall -verify %s
+// expected-no-diagnostics
#pragma adgohweopihweotnwet
diff --git a/test/Frontend/verify.c b/test/Frontend/verify.c
index f8d0f4282b4a..062e6bd8618f 100644
--- a/test/Frontend/verify.c
+++ b/test/Frontend/verify.c
@@ -22,7 +22,7 @@
#if 0
// expected-error {{should be ignored}}
#endif
-
+// eexpected-error {{should also be ignored: unrecognised directive}}
#error should not be ignored
// expected-error@-1 1+ {{should not be ignored}}
@@ -111,9 +111,10 @@ unexpected b; // expected-error@33 1-1 {{unknown type}}
#if 0
// RUN: %clang_cc1 -verify %t.invalid 2>&1 | FileCheck -check-prefix=CHECK6 %s
-// CHECK6: error: 'error' diagnostics seen but not expected:
+// CHECK6: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// CHECK6-NEXT: error: 'error' diagnostics seen but not expected:
// CHECK6-NEXT: (frontend): error reading '{{.*}}verify.c.tmp.invalid'
-// CHECK6-NEXT: 1 error generated.
+// CHECK6-NEXT: 2 errors generated.
// RUN: echo -e '//expected-error@2{{1}}\n#error 2' | %clang_cc1 -verify 2>&1 | FileCheck -check-prefix=CHECK7 %s
diff --git a/test/Frontend/verify2.c b/test/Frontend/verify2.c
index a1c797581ed9..04f80ad48e1a 100644
--- a/test/Frontend/verify2.c
+++ b/test/Frontend/verify2.c
@@ -3,7 +3,7 @@
// Please note that all comments are inside "#if 0" blocks so that
// VerifyDiagnosticConsumer sees no comments while processing this
-// test-case.
+// test-case (and hence no expected-* directives).
#endif
#include "verify2.h"
@@ -12,8 +12,9 @@
#if 0
// expected-error {{should be ignored}}
-// CHECK: error: 'error' diagnostics seen but not expected:
+// CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// CHECK-NEXT: error: 'error' diagnostics seen but not expected:
// CHECK-NEXT: Line 1: header
// CHECK-NEXT: Line 10: source
-// CHECK-NEXT: 2 errors generated.
+// CHECK-NEXT: 3 errors generated.
#endif
diff --git a/test/Frontend/verify3.c b/test/Frontend/verify3.c
new file mode 100644
index 000000000000..0705b4b7ee57
--- /dev/null
+++ b/test/Frontend/verify3.c
@@ -0,0 +1,41 @@
+// This test-case runs several sub-tests on -verify to ensure that correct
+// diagnostics are generated in relation to the mis-use and non-use of the
+// 'expected-no-diagnostics' directive.
+
+// RUN: %clang_cc1 -DTEST1 -verify %s 2>&1 | FileCheck -check-prefix=CHECK1 %s
+#ifdef TEST1
+// expected-no-diagnostics
+// expected-note {{}}
+
+// CHECK1: error: 'error' diagnostics seen but not expected:
+// CHECK1-NEXT: Line 8: expected directive cannot follow 'expected-no-diagnostics' directive
+// CHECK1-NEXT: 1 error generated.
+#endif
+
+// RUN: %clang_cc1 -DTEST2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
+#ifdef TEST2
+#warning X
+// expected-warning@-1 {{X}}
+// expected-no-diagnostics
+
+// CHECK2: error: 'error' diagnostics seen but not expected:
+// CHECK2-NEXT: Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives
+// CHECK2-NEXT: 1 error generated.
+#endif
+
+// RUN: %clang_cc1 -DTEST3 -verify %s 2>&1 | FileCheck -check-prefix=CHECK3 %s
+// RUN: %clang_cc1 -verify 2>&1 | FileCheck -check-prefix=CHECK3 %s
+#ifdef TEST3
+// no directives
+
+// CHECK3: error: no expected directives found: consider use of 'expected-no-diagnostics'
+// CHECK3-NEXT: 1 error generated.
+#endif
+
+// RUN: %clang_cc1 -E -DTEST4 -verify %s 2>&1 | FileCheck -check-prefix=CHECK4 %s
+#ifdef TEST4
+#warning X
+// expected-warning@-1 {{X}}
+
+// CHECK4-NOT: error: no expected directives found: consider use of 'expected-no-diagnostics'
+#endif
diff --git a/test/Frontend/warning-mapping-1.c b/test/Frontend/warning-mapping-1.c
index 883dafb1f500..623e5e3933a2 100644
--- a/test/Frontend/warning-mapping-1.c
+++ b/test/Frontend/warning-mapping-1.c
@@ -1,5 +1,6 @@
// Check that -w has higher priority than -Werror.
// RUN: %clang_cc1 -verify -Wsign-compare -Werror -w %s
+// expected-no-diagnostics
int f0(int x, unsigned y) {
return x < y;
diff --git a/test/Frontend/warning-mapping-4.c b/test/Frontend/warning-mapping-4.c
index d8d2769fc535..6644042e24ee 100644
--- a/test/Frontend/warning-mapping-4.c
+++ b/test/Frontend/warning-mapping-4.c
@@ -1,5 +1,6 @@
// RUN: %clang_cc1 -verify -Wno-error=sign-compare %s
// RUN: %clang_cc1 -verify -Wsign-compare -w -Wno-error=sign-compare %s
+// expected-no-diagnostics
int f0(int x, unsigned y) {
return x < y;