1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s 2 3 int main(int argc, char **argv) { 4 #pragma omp cancellation // expected-error {{expected an OpenMP directive}} 5 #pragma omp cancel // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} 6 ; 7 #pragma omp cancel parallel untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancel'}} 8 #pragma omp cancel unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} 9 #pragma omp cancel sections( // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} 10 #pragma omp cancel for, ) // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} 11 #pragma omp cancel taskgroup() // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} 12 #pragma omp cancel parallel, if // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} 13 if (argc) 14 #pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} 15 if (argc) { 16 #pragma omp taskgroup 17 #pragma omp task 18 #pragma omp parallel 19 { 20 #pragma omp cancel taskgroup // expected-error {{region cannot be closely nested inside 'parallel' region}} 21 } 22 } 23 #pragma omp parallel 24 #pragma omp taskgroup 25 { 26 #pragma omp cancel taskgroup // expected-error {{region cannot be closely nested inside 'taskgroup' region}} 27 } 28 #pragma omp parallel 29 { 30 #pragma omp cancel for // expected-error {{region cannot be closely nested inside 'parallel' region}} 31 } 32 #pragma omp task 33 { 34 #pragma omp cancel sections // expected-error {{region cannot be closely nested inside 'task' region}} 35 } 36 #pragma omp sections 37 { 38 #pragma omp cancel parallel // expected-error {{region cannot be closely nested inside 'sections' region}} 39 } 40 while (argc) 41 #pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} 42 while (argc) { 43 #pragma omp cancel sections 44 } 45 do 46 #pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} 47 while (argc) 48 ; 49 do { 50 #pragma omp cancel taskgroup 51 } while (argc); 52 switch (argc) 53 #pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} 54 switch (argc) 55 case 1: 56 #pragma omp cancel sections 57 switch (argc) 58 case 1: { 59 #pragma omp cancel for 60 } 61 switch (argc) { 62 #pragma omp cancel taskgroup 63 case 1: 64 #pragma omp cancel parallel 65 break; 66 default: { 67 #pragma omp cancel sections 68 } break; 69 } 70 for (;;) 71 #pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} 72 for (;;) { 73 #pragma omp cancel taskgroup 74 } 75 label: 76 #pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} 77 label1 : { 78 #pragma omp cancel sections 79 } 80 81 return 0; 82 } 83 84