verify2.c 1.4 KB

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