diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 056abd2059c65a3e908193aeae16fad98017437c (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/Frontend | |
parent | cc73504950eb7b5dff2dded9bedd67bc36d64641 (diff) | |
download | FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'test/Frontend')
-rw-r--r-- | test/Frontend/ast-codegen.c | 4 | ||||
-rw-r--r-- | test/Frontend/iframework.c | 3 | ||||
-rw-r--r-- | test/Frontend/macros.c | 9 | ||||
-rw-r--r-- | test/Frontend/unknown-pragmas.c | 1 | ||||
-rw-r--r-- | test/Frontend/verify.c | 7 | ||||
-rw-r--r-- | test/Frontend/verify2.c | 7 | ||||
-rw-r--r-- | test/Frontend/verify3.c | 41 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-1.c | 1 | ||||
-rw-r--r-- | test/Frontend/warning-mapping-4.c | 1 |
9 files changed, 65 insertions, 9 deletions
diff --git a/test/Frontend/ast-codegen.c b/test/Frontend/ast-codegen.c index b5b2157..b85c5dc 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 0c241fd..6f801f2 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 3170797..68f2203 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 53a5a45..eea025c 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 f8d0f42..062e6bd 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 a1c7975..04f80ad 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 0000000..0705b4b --- /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 883dafb..623e5e3 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 d8d2769..6644042 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; |