1*47d6094dScchen // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
2*47d6094dScchen
3*47d6094dScchen // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
4*47d6094dScchen
foo()5*47d6094dScchen void foo() {
6*47d6094dScchen }
7*47d6094dScchen
foobool(int argc)8*47d6094dScchen bool foobool(int argc) {
9*47d6094dScchen return argc;
10*47d6094dScchen }
11*47d6094dScchen
12*47d6094dScchen struct S1; // expected-note {{declared here}}
13*47d6094dScchen
14*47d6094dScchen template <class T, typename S, int N> // expected-note {{declared here}}
tmain(T argc,S ** argv)15*47d6094dScchen T tmain(T argc, S **argv) {
16*47d6094dScchen T z;
17*47d6094dScchen #pragma omp parallel master num_threads // expected-error {{expected '(' after 'num_threads'}}
18*47d6094dScchen {foo();}
19*47d6094dScchen #pragma omp parallel master num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20*47d6094dScchen {foo();}
21*47d6094dScchen #pragma omp parallel master num_threads () // expected-error {{expected expression}}
22*47d6094dScchen {foo();}
23*47d6094dScchen #pragma omp parallel master num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
24*47d6094dScchen {foo();}
25*47d6094dScchen #pragma omp parallel master num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master' are ignored}}
26*47d6094dScchen {foo();}
27*47d6094dScchen #pragma omp parallel master num_threads ((argc > 0) ? argv[1] : argv[2]) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
28*47d6094dScchen {foo();}
29*47d6094dScchen #pragma omp parallel master num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel master' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a strictly positive integer value}}
30*47d6094dScchen {foo();}
31*47d6094dScchen #pragma omp parallel master num_threads (S) // expected-error {{'S' does not refer to a value}}
32*47d6094dScchen {foo();}
33*47d6094dScchen #pragma omp parallel master num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
34*47d6094dScchen {foo();}
35*47d6094dScchen #pragma omp parallel master num_threads (argc + z)
36*47d6094dScchen {foo();}
37*47d6094dScchen #pragma omp parallel master num_threads (N) // expected-error {{argument to 'num_threads' clause must be a strictly positive integer value}}
38*47d6094dScchen {foo();}
39*47d6094dScchen
40*47d6094dScchen return argc;
41*47d6094dScchen }
42*47d6094dScchen
main(int argc,char ** argv)43*47d6094dScchen int main(int argc, char **argv) {
44*47d6094dScchen int z;
45*47d6094dScchen #pragma omp parallel master num_threads // expected-error {{expected '(' after 'num_threads'}}
46*47d6094dScchen {foo();}
47*47d6094dScchen #pragma omp parallel master num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
48*47d6094dScchen {foo();}
49*47d6094dScchen #pragma omp parallel master num_threads () // expected-error {{expected expression}}
50*47d6094dScchen {foo();}
51*47d6094dScchen #pragma omp parallel master num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
52*47d6094dScchen {foo();}
53*47d6094dScchen #pragma omp parallel master num_threads (argc / z)) // expected-warning {{extra tokens at the end of '#pragma omp parallel master' are ignored}}
54*47d6094dScchen {foo();}
55*47d6094dScchen #pragma omp parallel master num_threads (argc > 0 ? argv[1] : argv[2]) // expected-error {{integral }}
56*47d6094dScchen {foo();}
57*47d6094dScchen #pragma omp parallel master num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel master' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a strictly positive integer value}}
58*47d6094dScchen {foo();}
59*47d6094dScchen #pragma omp parallel master num_threads (S1) // expected-error {{'S1' does not refer to a value}}
60*47d6094dScchen {foo();}
61*47d6094dScchen #pragma omp parallel master num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
62*47d6094dScchen {foo();}
63*47d6094dScchen #pragma omp parallel master num_threads (num_threads(tmain<int, char, -1>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1>' requested here}}
64*47d6094dScchen {foo();}
65*47d6094dScchen
66*47d6094dScchen return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}}
67*47d6094dScchen }
68