Home | History | Annotate | Download | only in Frontend
      1 // RUN: not %clang_cc1 -DTEST_SWITCH -verify-ignore-unexpected=remark,aoeu,note -verify %s 2>&1 \
      2 // RUN:     | FileCheck -check-prefix=CHECK-BAD-SWITCH %s
      3 #ifdef TEST_SWITCH
      4 // expected-no-diagnostics
      5 #endif
      6 // CHECK-BAD-SWITCH: error: 'error' diagnostics seen but not expected:
      7 // CHECK-BAD-SWITCH-NEXT: (frontend): invalid value 'aoeu' in '-verify-ignore-unexpected='
      8 
      9 // RUN: %clang_cc1 -DTEST1 -verify %s
     10 // RUN: %clang_cc1 -DTEST1 -verify -verify-ignore-unexpected %s
     11 #ifdef TEST1
     12 #warning MyWarning1
     13     // expected-warning@-1 {{MyWarning1}}
     14 int x; // expected-note {{previous definition is here}}
     15 float x; // expected-error {{redefinition of 'x'}}
     16 #endif
     17 
     18 // RUN: not %clang_cc1 -DTEST2 -verify %s 2>&1 \
     19 // RUN:     | FileCheck -check-prefix=CHECK-UNEXP %s
     20 // RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected= %s 2>&1 \
     21 // RUN:     | FileCheck -check-prefix=CHECK-UNEXP %s
     22 // RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected=note %s 2>&1 \
     23 // RUN:     | FileCheck -check-prefix=CHECK-NOTE %s
     24 // RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected=warning %s 2>&1 \
     25 // RUN:     | FileCheck -check-prefix=CHECK-WARN %s
     26 // RUN: not %clang_cc1 -DTEST2 -verify -verify-ignore-unexpected=error %s 2>&1 \
     27 // RUN:     | FileCheck -check-prefix=CHECK-ERR %s
     28 #ifdef TEST2
     29 #warning MyWarning2
     30 int x;
     31 float x;
     32 #endif
     33 // CHECK-UNEXP: no expected directives found
     34 // CHECK-UNEXP-NEXT: 'error' diagnostics seen but not expected
     35 // CHECK-UNEXP-NEXT: Line {{[0-9]+}}: redefinition of 'x'
     36 // CHECK-UNEXP-NEXT: 'warning' diagnostics seen but not expected
     37 // CHECK-UNEXP-NEXT: Line {{[0-9]+}}: MyWarning2
     38 // CHECK-UNEXP-NEXT: 'note' diagnostics seen but not expected
     39 // CHECK-UNEXP-NEXT: Line {{[0-9]+}}: previous definition is here
     40 // CHECK-UNEXP-NEXT: 4 errors generated.
     41 
     42 // CHECK-NOTE: no expected directives found
     43 // CHECK-NOTE-NEXT: 'error' diagnostics seen but not expected
     44 // CHECK-NOTE-NEXT: Line {{[0-9]+}}: redefinition of 'x'
     45 // CHECK-NOTE-NEXT: 'warning' diagnostics seen but not expected
     46 // CHECK-NOTE-NEXT: Line {{[0-9]+}}: MyWarning2
     47 // CHECK-NOTE-NEXT: 3 errors generated.
     48 
     49 // CHECK-WARN: no expected directives found
     50 // CHECK-WARN-NEXT: 'error' diagnostics seen but not expected
     51 // CHECK-WARN-NEXT: Line {{[0-9]+}}: redefinition of 'x'
     52 // CHECK-WARN-NEXT: 'note' diagnostics seen but not expected
     53 // CHECK-WARN-NEXT: Line {{[0-9]+}}: previous definition is here
     54 // CHECK-WARN-NEXT: 3 errors generated.
     55 
     56 // CHECK-ERR: no expected directives found
     57 // CHECK-ERR-NEXT: 'warning' diagnostics seen but not expected
     58 // CHECK-ERR-NEXT: Line {{[0-9]+}}: MyWarning2
     59 // CHECK-ERR-NEXT: 'note' diagnostics seen but not expected
     60 // CHECK-ERR-NEXT: Line {{[0-9]+}}: previous definition is here
     61 // CHECK-ERR-NEXT: 3 errors generated.
     62 
     63 // RUN: not %clang_cc1 -DTEST3 -verify -verify-ignore-unexpected %s 2>&1 \
     64 // RUN:     | FileCheck -check-prefix=CHECK-EXP %s
     65 #ifdef TEST3
     66 // expected-error {{test3}}
     67 #endif
     68 // CHECK-EXP: 'error' diagnostics expected but not seen
     69 // CHECK-EXP-NEXT: Line {{[0-9]+}}: test3
     70 
     71 // RUN: not %clang_cc1 -DTEST4 -verify -verify-ignore-unexpected %s 2>&1 \
     72 // RUN:     | FileCheck -check-prefix=CHECK-NOEXP %s
     73 // RUN: not %clang_cc1 -DTEST4 -verify -verify-ignore-unexpected=warning,error,note %s 2>&1 \
     74 // RUN:     | FileCheck -check-prefix=CHECK-NOEXP %s
     75 #ifdef TEST4
     76 #warning MyWarning4
     77 int x;
     78 float x;
     79 #endif
     80 // CHECK-NOEXP: error: no expected directives found
     81 // CHECK-NOEXP-NEXT: 1 error generated
     82