xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/taskyield_messages.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc template <class T>
tmain(T argc)4*0a6a1f1dSLionel Sambuc T tmain(T argc) {
5*0a6a1f1dSLionel Sambuc #pragma omp taskyield
6*0a6a1f1dSLionel Sambuc   ;
7*0a6a1f1dSLionel Sambuc #pragma omp taskyield untied  // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskyield'}}
8*0a6a1f1dSLionel Sambuc #pragma omp taskyield unknown // expected-warning {{extra tokens at the end of '#pragma omp taskyield' are ignored}}
9*0a6a1f1dSLionel Sambuc   if (argc)
10*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
11*0a6a1f1dSLionel Sambuc     if (argc) {
12*0a6a1f1dSLionel Sambuc #pragma omp taskyield
13*0a6a1f1dSLionel Sambuc     }
14*0a6a1f1dSLionel Sambuc   while (argc)
15*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
16*0a6a1f1dSLionel Sambuc     while (argc) {
17*0a6a1f1dSLionel Sambuc #pragma omp taskyield
18*0a6a1f1dSLionel Sambuc     }
19*0a6a1f1dSLionel Sambuc   do
20*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
21*0a6a1f1dSLionel Sambuc     while (argc)
22*0a6a1f1dSLionel Sambuc       ;
23*0a6a1f1dSLionel Sambuc   do {
24*0a6a1f1dSLionel Sambuc #pragma omp taskyield
25*0a6a1f1dSLionel Sambuc   } while (argc);
26*0a6a1f1dSLionel Sambuc   switch (argc)
27*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
28*0a6a1f1dSLionel Sambuc     switch (argc)
29*0a6a1f1dSLionel Sambuc     case 1:
30*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
31*0a6a1f1dSLionel Sambuc   switch (argc)
32*0a6a1f1dSLionel Sambuc   case 1: {
33*0a6a1f1dSLionel Sambuc #pragma omp taskyield
34*0a6a1f1dSLionel Sambuc   }
35*0a6a1f1dSLionel Sambuc   switch (argc) {
36*0a6a1f1dSLionel Sambuc #pragma omp taskyield
37*0a6a1f1dSLionel Sambuc   case 1:
38*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
39*0a6a1f1dSLionel Sambuc     break;
40*0a6a1f1dSLionel Sambuc   default: {
41*0a6a1f1dSLionel Sambuc #pragma omp taskyield
42*0a6a1f1dSLionel Sambuc   } break;
43*0a6a1f1dSLionel Sambuc   }
44*0a6a1f1dSLionel Sambuc   for (;;)
45*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
46*0a6a1f1dSLionel Sambuc     for (;;) {
47*0a6a1f1dSLionel Sambuc #pragma omp taskyield
48*0a6a1f1dSLionel Sambuc     }
49*0a6a1f1dSLionel Sambuc label:
50*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
51*0a6a1f1dSLionel Sambuc label1 : {
52*0a6a1f1dSLionel Sambuc #pragma omp taskyield
53*0a6a1f1dSLionel Sambuc }
54*0a6a1f1dSLionel Sambuc 
55*0a6a1f1dSLionel Sambuc   return T();
56*0a6a1f1dSLionel Sambuc }
57*0a6a1f1dSLionel Sambuc 
main(int argc,char ** argv)58*0a6a1f1dSLionel Sambuc int main(int argc, char **argv) {
59*0a6a1f1dSLionel Sambuc #pragma omp taskyield
60*0a6a1f1dSLionel Sambuc   ;
61*0a6a1f1dSLionel Sambuc #pragma omp taskyield untied  // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskyield'}}
62*0a6a1f1dSLionel Sambuc #pragma omp taskyield unknown // expected-warning {{extra tokens at the end of '#pragma omp taskyield' are ignored}}
63*0a6a1f1dSLionel Sambuc   if (argc)
64*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
65*0a6a1f1dSLionel Sambuc     if (argc) {
66*0a6a1f1dSLionel Sambuc #pragma omp taskyield
67*0a6a1f1dSLionel Sambuc     }
68*0a6a1f1dSLionel Sambuc   while (argc)
69*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
70*0a6a1f1dSLionel Sambuc     while (argc) {
71*0a6a1f1dSLionel Sambuc #pragma omp taskyield
72*0a6a1f1dSLionel Sambuc     }
73*0a6a1f1dSLionel Sambuc   do
74*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
75*0a6a1f1dSLionel Sambuc     while (argc)
76*0a6a1f1dSLionel Sambuc       ;
77*0a6a1f1dSLionel Sambuc   do {
78*0a6a1f1dSLionel Sambuc #pragma omp taskyield
79*0a6a1f1dSLionel Sambuc   } while (argc);
80*0a6a1f1dSLionel Sambuc   switch (argc)
81*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
82*0a6a1f1dSLionel Sambuc     switch (argc)
83*0a6a1f1dSLionel Sambuc     case 1:
84*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
85*0a6a1f1dSLionel Sambuc   switch (argc)
86*0a6a1f1dSLionel Sambuc   case 1: {
87*0a6a1f1dSLionel Sambuc #pragma omp taskyield
88*0a6a1f1dSLionel Sambuc   }
89*0a6a1f1dSLionel Sambuc   switch (argc) {
90*0a6a1f1dSLionel Sambuc #pragma omp taskyield
91*0a6a1f1dSLionel Sambuc   case 1:
92*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
93*0a6a1f1dSLionel Sambuc     break;
94*0a6a1f1dSLionel Sambuc   default: {
95*0a6a1f1dSLionel Sambuc #pragma omp taskyield
96*0a6a1f1dSLionel Sambuc   } break;
97*0a6a1f1dSLionel Sambuc   }
98*0a6a1f1dSLionel Sambuc   for (;;)
99*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
100*0a6a1f1dSLionel Sambuc     for (;;) {
101*0a6a1f1dSLionel Sambuc #pragma omp taskyield
102*0a6a1f1dSLionel Sambuc     }
103*0a6a1f1dSLionel Sambuc label:
104*0a6a1f1dSLionel Sambuc #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}}
105*0a6a1f1dSLionel Sambuc label1 : {
106*0a6a1f1dSLionel Sambuc #pragma omp taskyield
107*0a6a1f1dSLionel Sambuc }
108*0a6a1f1dSLionel Sambuc 
109*0a6a1f1dSLionel Sambuc   return tmain(argc);
110*0a6a1f1dSLionel Sambuc }
111