Jordan Rose | b00073d | 2012-08-10 01:06:16 +0000 | [diff] [blame] | 1 | #if 0 |
Rafael Espindola | 925213b | 2013-07-04 16:16:58 +0000 | [diff] [blame] | 2 | // RUN: not %clang_cc1 -verify %s 2>&1 | FileCheck %s |
Jordan Rose | b00073d | 2012-08-10 01:06:16 +0000 | [diff] [blame] | 3 | |
| 4 | // Please note that all comments are inside "#if 0" blocks so that |
| 5 | // VerifyDiagnosticConsumer sees no comments while processing this |
Andy Gibbs | 0fea045 | 2012-10-19 12:49:32 +0000 | [diff] [blame] | 6 | // test-case (and hence no expected-* directives). |
Jordan Rose | b00073d | 2012-08-10 01:06:16 +0000 | [diff] [blame] | 7 | #endif |
| 8 | |
| 9 | #include "verify2.h" |
| 10 | #error source |
| 11 | |
| 12 | #if 0 |
| 13 | // expected-error {{should be ignored}} |
| 14 | |
Andy Gibbs | 0fea045 | 2012-10-19 12:49:32 +0000 | [diff] [blame] | 15 | // CHECK: error: no expected directives found: consider use of 'expected-no-diagnostics' |
| 16 | // CHECK-NEXT: error: 'error' diagnostics seen but not expected: |
Andy Gibbs | c1f152e | 2014-07-10 16:43:29 +0000 | [diff] [blame] | 17 | // CHECK-NEXT: Line 5: header |
Jordan Rose | b00073d | 2012-08-10 01:06:16 +0000 | [diff] [blame] | 18 | // CHECK-NEXT: Line 10: source |
Andy Gibbs | 0fea045 | 2012-10-19 12:49:32 +0000 | [diff] [blame] | 19 | // CHECK-NEXT: 3 errors generated. |
Jordan Rose | b00073d | 2012-08-10 01:06:16 +0000 | [diff] [blame] | 20 | #endif |
Andy Gibbs | c1f152e | 2014-07-10 16:43:29 +0000 | [diff] [blame] | 21 | |
| 22 | #ifdef CHECK2 |
| 23 | // RUN: not %clang_cc1 -DCHECK2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s |
| 24 | |
| 25 | // The following checks that -verify can match "any line" in an included file. |
| 26 | // The location of the diagnostic need therefore only match in the file, not to |
| 27 | // a specific line number. This is useful where -verify is used as a testing |
| 28 | // tool for 3rd-party libraries where headers may change and the specific line |
| 29 | // number of a diagnostic in a header is not important. |
| 30 | |
| 31 | // expected-error@verify2.h:* {{header}} |
| 32 | // expected-error@verify2.h:* {{unknown}} |
| 33 | |
| 34 | // CHECK2: error: 'error' diagnostics expected but not seen: |
| 35 | // CHECK2-NEXT: File {{.*}}verify2.h Line * (directive at {{.*}}verify2.c:32): unknown |
| 36 | // CHECK2-NEXT: error: 'error' diagnostics seen but not expected: |
| 37 | // CHECK2-NEXT: File {{.*}}verify2.c Line 10: source |
| 38 | // CHECK2-NEXT: 2 errors generated. |
| 39 | #endif |