Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
      2 
      3 void foo();
      4 
      5 template <class T, int N>
      6 T tmain(T argc) {
      7   int i;
      8 #pragma omp target
      9 #pragma omp teams
     10 #pragma omp distribute parallel for simd default // expected-error {{expected '(' after 'default'}}
     11   for (i = 0; i < argc; ++i)
     12     foo();
     13 #pragma omp target
     14 #pragma omp teams
     15 #pragma omp distribute parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     16   for (i = 0; i < argc; ++i)
     17     foo();
     18 #pragma omp target
     19 #pragma omp teams
     20 #pragma omp distribute parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
     21   for (i = 0; i < argc; ++i)
     22     foo();
     23 #pragma omp target
     24 #pragma omp teams
     25 #pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
     26   for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
     27     foo();
     28 #pragma omp target
     29 #pragma omp teams
     30 #pragma omp distribute parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'default' clause}}
     31   for (i = 0; i < argc; ++i)
     32     foo();
     33 #pragma omp target
     34 #pragma omp teams
     35 #pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
     36   for (i = 0; i < argc; ++i)
     37     foo();
     38 #pragma omp target
     39 #pragma omp teams
     40 #pragma omp distribute parallel for simd default(none)
     41   for (i = 0; i < argc; ++i)  // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}}
     42     foo();
     43 
     44 #pragma omp parallel default(none)
     45 #pragma omp target
     46 #pragma omp teams
     47 #pragma omp distribute parallel for simd default(shared)
     48   for (i = 0; i < argc; ++i)
     49     foo();
     50 
     51   return T();
     52 }
     53 
     54 int main(int argc, char **argv) {
     55   int i;
     56 #pragma omp target
     57 #pragma omp teams
     58 #pragma omp distribute parallel for simd default // expected-error {{expected '(' after 'default'}}
     59   for (i = 0; i < argc; ++i)
     60     foo();
     61 #pragma omp target
     62 #pragma omp teams
     63 #pragma omp distribute parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     64   for (i = 0; i < argc; ++i)
     65     foo();
     66 #pragma omp target
     67 #pragma omp teams
     68 #pragma omp distribute parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
     69   for (i = 0; i < argc; ++i)
     70     foo();
     71 #pragma omp target
     72 #pragma omp teams
     73 #pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
     74   for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
     75     foo();
     76 #pragma omp target
     77 #pragma omp teams
     78 #pragma omp distribute parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'default' clause}}
     79   for (i = 0; i < argc; ++i)
     80     foo();
     81 #pragma omp target
     82 #pragma omp teams
     83 #pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
     84   for (i = 0; i < argc; ++i)
     85     foo();
     86 #pragma omp target
     87 #pragma omp teams
     88 #pragma omp distribute parallel for simd default(none)
     89   for (i = 0; i < argc; ++i)  // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
     90     foo();
     91 
     92 #pragma omp parallel default(none)
     93 #pragma omp target
     94 #pragma omp teams
     95 #pragma omp distribute parallel for simd default(shared)
     96   for (i = 0; i < argc; ++i)
     97     foo();
     98 
     99   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}
    100 }
    101