Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s
      2 
      3 void foo() {
      4 }
      5 
      6 bool foobool(int argc) {
      7   return argc;
      8 }
      9 
     10 struct S1; // expected-note {{declared here}} expected-note {{declared here}}
     11 
     12 template <class T, int N>
     13 T tmain(T argc) {
     14   T b = argc, c, d, e, f, g;
     15   char ** argv;
     16   static T a;
     17 // CHECK: static T a;
     18 #pragma omp target
     19 #pragma omp teams
     20 #pragma omp distribute parallel for simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
     21   for (int i = 0; i < 10; ++i) foo();
     22 #pragma omp target
     23 #pragma omp teams
     24 #pragma omp distribute parallel for simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     25   for (int i = 0; i < 10; ++i) foo();
     26 #pragma omp target
     27 #pragma omp teams
     28 #pragma omp distribute parallel for simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
     29   for (int i = 0; i < 10; ++i) foo();
     30 #pragma omp target
     31 #pragma omp teams
     32 #pragma omp distribute parallel for simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
     33   for (int i = 0; i < 10; ++i) foo();
     34 #pragma omp target
     35 #pragma omp teams
     36 #pragma omp distribute parallel for simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     37   for (int i = 0; i < 10; ++i) foo();
     38 #pragma omp target
     39 #pragma omp teams
     40 #pragma omp distribute parallel for simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
     41   for (int i = 0; i < 10; ++i) foo();
     42 #pragma omp target
     43 #pragma omp teams
     44 #pragma omp distribute parallel for simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
     45   for (int i = 0; i < 10; ++i) foo();
     46 #pragma omp target
     47 #pragma omp teams
     48 #pragma omp distribute parallel for simd dist_schedule (static), dist_schedule (static, 1) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'dist_schedule' clause}}
     49   for (int i = 0; i < 10; ++i) foo();
     50 #pragma omp target
     51 #pragma omp teams
     52 #pragma omp distribute parallel for simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
     53   for (int i = 0; i < 10; ++i) foo();
     54 #pragma omp target
     55 #pragma omp teams
     56 #pragma omp distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
     57   for (int i = 0; i < 10; ++i) foo();
     58   return T();
     59 }
     60 
     61 int main(int argc, char **argv) {
     62 #pragma omp target
     63 #pragma omp teams
     64 #pragma omp distribute parallel for simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
     65   for (int i = 0; i < 10; ++i) foo();
     66 #pragma omp target
     67 #pragma omp teams
     68 #pragma omp distribute parallel for simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     69   for (int i = 0; i < 10; ++i) foo();
     70 #pragma omp target
     71 #pragma omp teams
     72 #pragma omp distribute parallel for simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
     73   for (int i = 0; i < 10; ++i) foo();
     74 #pragma omp target
     75 #pragma omp teams
     76 #pragma omp distribute parallel for simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
     77   for (int i = 0; i < 10; ++i) foo();
     78 #pragma omp target
     79 #pragma omp teams
     80 #pragma omp distribute parallel for simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     81   for (int i = 0; i < 10; ++i) foo();
     82 #pragma omp target
     83 #pragma omp teams
     84 #pragma omp distribute parallel for simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
     85   for (int i = 0; i < 10; ++i) foo();
     86 #pragma omp target
     87 #pragma omp teams
     88 #pragma omp distribute parallel for simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
     89   for (int i = 0; i < 10; ++i) foo();
     90 #pragma omp target
     91 #pragma omp teams
     92 #pragma omp distribute parallel for simd dist_schedule (static), dist_schedule (static, 1) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'dist_schedule' clause}}
     93   for (int i = 0; i < 10; ++i) foo();
     94 #pragma omp target
     95 #pragma omp teams
     96 #pragma omp distribute parallel for simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
     97   for (int i = 0; i < 10; ++i) foo();
     98 #pragma omp target
     99 #pragma omp teams
    100 #pragma omp distribute parallel for simd dist_schedule (static, argv[1]=2) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
    101   for (int i = 0; i < 10; ++i) foo();
    102   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}}
    103 }
    104