blob: 2bf667c4078854becfe6738024d80b387f846f57 [file] [log] [blame]
Alexey Bataev6d4ed052015-07-01 06:57:41 +00001// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2
Alexey Bataeva8a9153a2017-12-29 18:07:07 +00003// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
4
Alexey Bataev6d4ed052015-07-01 06:57:41 +00005int main(int argc, char **argv) {
6#pragma omp cancellation // expected-error {{expected an OpenMP directive}}
7#pragma omp cancellation point // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
8 ;
Jonas Hahnfeld64a9e3c2017-02-22 06:49:10 +00009#pragma omp parallel
10 {
11#pragma omp cancellation point // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
12 }
Alexey Bataev185e88d2019-01-08 15:53:42 +000013#pragma omp cancellation point parallel untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancellation point'}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000014#pragma omp cancellation point unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
Jonas Hahnfeld64a9e3c2017-02-22 06:49:10 +000015#pragma omp parallel
16 {
17#pragma omp cancellation point unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
18 }
Alexey Bataev185e88d2019-01-08 15:53:42 +000019#pragma omp cancellation point sections( // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
20#pragma omp cancellation point for, ) // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
21#pragma omp cancellation point taskgroup() // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
22#pragma omp cancellation point parallel, if // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000023 if (argc)
Alexey Bataev185e88d2019-01-08 15:53:42 +000024#pragma omp cancellation point for // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000025 if (argc) {
26#pragma omp taskgroup
27#pragma omp task
28#pragma omp parallel
29 {
30#pragma omp cancellation point taskgroup // expected-error {{region cannot be closely nested inside 'parallel' region}}
31 }
32 }
33#pragma omp parallel
34#pragma omp taskgroup
35 {
36#pragma omp cancellation point taskgroup // expected-error {{region cannot be closely nested inside 'taskgroup' region}}
37 }
38#pragma omp parallel
39 {
40#pragma omp cancellation point for // expected-error {{region cannot be closely nested inside 'parallel' region}}
41 }
42#pragma omp task
43 {
44#pragma omp cancellation point sections // expected-error {{region cannot be closely nested inside 'task' region}}
45 }
46#pragma omp sections
47 {
48#pragma omp cancellation point parallel // expected-error {{region cannot be closely nested inside 'sections' region}}
49 }
50 while (argc)
Alexey Bataev185e88d2019-01-08 15:53:42 +000051#pragma omp cancellation point for // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000052 while (argc) {
Alexey Bataev185e88d2019-01-08 15:53:42 +000053#pragma omp cancellation point sections // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000054 }
55 do
Alexey Bataev185e88d2019-01-08 15:53:42 +000056#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000057 while (argc)
58 ;
59 do {
Alexey Bataev185e88d2019-01-08 15:53:42 +000060#pragma omp cancellation point taskgroup // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000061 } while (argc);
62 switch (argc)
Alexey Bataev185e88d2019-01-08 15:53:42 +000063#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000064 switch (argc)
65 case 1:
Alexey Bataev185e88d2019-01-08 15:53:42 +000066#pragma omp cancellation point sections // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000067 switch (argc)
68 case 1: {
Alexey Bataev185e88d2019-01-08 15:53:42 +000069#pragma omp cancellation point for // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000070 }
71 switch (argc) {
Alexey Bataev185e88d2019-01-08 15:53:42 +000072#pragma omp cancellation point taskgroup // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000073 case 1:
Alexey Bataev185e88d2019-01-08 15:53:42 +000074#pragma omp cancellation point parallel // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000075 break;
76 default: {
Alexey Bataev185e88d2019-01-08 15:53:42 +000077#pragma omp cancellation point sections // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000078 } break;
79 }
80 for (;;)
Alexey Bataev185e88d2019-01-08 15:53:42 +000081#pragma omp cancellation point for // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000082 for (;;) {
Alexey Bataev185e88d2019-01-08 15:53:42 +000083#pragma omp cancellation point taskgroup // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000084 }
85label:
Alexey Bataev185e88d2019-01-08 15:53:42 +000086#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000087label1 : {
Alexey Bataev185e88d2019-01-08 15:53:42 +000088#pragma omp cancellation point sections // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}}
Alexey Bataev6d4ed052015-07-01 06:57:41 +000089}
90
91 return 0;
92}
93