xref: /llvm-project/clang/test/OpenMP/parallel_for_default_messages.cpp (revision 41ebe0ce64bfc5ea208fc391b6dabd39bf670cec)
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s
2 
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s
4 
5 void foo();
6 
7 int main(int argc, char **argv) {
8   int i;
9 #pragma omp parallel for default // expected-error {{expected '(' after 'default'}}
10   for (i = 0; i < argc; ++i)
11     foo();
12 #pragma omp parallel for default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
13   for (i = 0; i < argc; ++i)
14     foo();
15 #pragma omp parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
16   for (i = 0; i < argc; ++i)
17     foo();
18 #pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}
19   for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
20     foo();
21 #pragma omp parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'default' clause}}
22   for (i = 0; i < argc; ++i)
23     foo();
24 #pragma omp parallel for default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
25   for (i = 0; i < argc; ++i)
26     foo();
27 
28 #pragma omp parallel for default(none) // expected-note {{explicit data sharing attribute requested here}}
29   for (i = 0; i < argc; ++i)  // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
30     foo();
31 
32 #pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}}
33 #pragma omp parallel for default(shared)
34   for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
35     foo();
36 
37   return 0;
38 }
39