1*f4a2713aSLionel Sambuc // This test-case runs several sub-tests on -verify to ensure that correct 2*f4a2713aSLionel Sambuc // diagnostics are generated in relation to the mis-use and non-use of the 3*f4a2713aSLionel Sambuc // 'expected-no-diagnostics' directive. 4*f4a2713aSLionel Sambuc 5*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -DTEST1 -verify %s 2>&1 | FileCheck -check-prefix=CHECK1 %s 6*f4a2713aSLionel Sambuc #ifdef TEST1 7*f4a2713aSLionel Sambuc // expected-no-diagnostics 8*f4a2713aSLionel Sambuc // expected-note {{}} 9*f4a2713aSLionel Sambuc 10*f4a2713aSLionel Sambuc // CHECK1: error: 'error' diagnostics seen but not expected: 11*f4a2713aSLionel Sambuc // CHECK1-NEXT: Line 8: expected directive cannot follow 'expected-no-diagnostics' directive 12*f4a2713aSLionel Sambuc // CHECK1-NEXT: 1 error generated. 13*f4a2713aSLionel Sambuc #endif 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -DTEST2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s 16*f4a2713aSLionel Sambuc #ifdef TEST2 17*f4a2713aSLionel Sambuc #warning X 18*f4a2713aSLionel Sambuc // expected-warning@-1 {{X}} 19*f4a2713aSLionel Sambuc // expected-no-diagnostics 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc // CHECK2: error: 'error' diagnostics seen but not expected: 22*f4a2713aSLionel Sambuc // CHECK2-NEXT: Line 19: 'expected-no-diagnostics' directive cannot follow other expected directives 23*f4a2713aSLionel Sambuc // CHECK2-NEXT: 1 error generated. 24*f4a2713aSLionel Sambuc #endif 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -DTEST3 -verify %s 2>&1 | FileCheck -check-prefix=CHECK3 %s 27*f4a2713aSLionel Sambuc // RUN: not %clang_cc1 -verify %s 2>&1 | FileCheck -check-prefix=CHECK3 %s 28*f4a2713aSLionel Sambuc #ifdef TEST3 29*f4a2713aSLionel Sambuc // no directives 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc // CHECK3: error: no expected directives found: consider use of 'expected-no-diagnostics' 32*f4a2713aSLionel Sambuc // CHECK3-NEXT: 1 error generated. 33*f4a2713aSLionel Sambuc #endif 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -E -DTEST4 -verify %s 2>&1 | FileCheck -check-prefix=CHECK4 %s 36*f4a2713aSLionel Sambuc #ifdef TEST4 37*f4a2713aSLionel Sambuc #warning X 38*f4a2713aSLionel Sambuc // expected-warning@-1 {{X}} 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc // CHECK4-NOT: error: no expected directives found: consider use of 'expected-no-diagnostics' 41*f4a2713aSLionel Sambuc #endif 42