Clang Project

clang_source_code/test/OpenMP/target_teams_if_messages.cpp
1// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s
2
3// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s
4
5void foo() {
6}
7
8bool foobool(int argc) {
9  return argc;
10}
11
12struct S1; // expected-note {{declared here}}
13
14template <class T, class S> // expected-note {{declared here}}
15int tmain(T argc, S **argv) {
16#pragma omp target teams if // expected-error {{expected '(' after 'if'}}
17  foo();
18#pragma omp target teams if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
19  foo();
20#pragma omp target teams if () // expected-error {{expected expression}}
21  foo();
22#pragma omp target teams if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
23  foo();
24#pragma omp target teams if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}}
25  foo();
26#pragma omp target teams if (argc > 0 ? argv[1] : argv[2])
27  foo();
28#pragma omp target teams if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause}}
29  foo();
30#pragma omp target teams if (S) // expected-error {{'S' does not refer to a value}}
31  foo();
32#pragma omp target teams if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
33  foo();
34#pragma omp target teams if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
35  foo();
36#pragma omp target teams if(argc)
37  foo();
38#pragma omp target teams if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
39  foo();
40#pragma omp target teams if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
41  foo();
42#pragma omp target teams if(target : argc)
43  foo();
44#pragma omp target teams if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams'}}
45  foo();
46#pragma omp target teams if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause with 'target' name modifier}}
47  foo();
48#pragma omp target teams if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
49  foo();
50
51  return 0;
52}
53
54int main(int argc, char **argv) {
55#pragma omp target teams if // expected-error {{expected '(' after 'if'}}
56  foo();
57#pragma omp target teams if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
58  foo();
59#pragma omp target teams if () // expected-error {{expected expression}}
60  foo();
61#pragma omp target teams if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
62  foo();
63#pragma omp target teams if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams' are ignored}}
64  foo();
65#pragma omp target teams if (argc > 0 ? argv[1] : argv[2])
66  foo();
67#pragma omp target teams if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause}}
68  foo();
69#pragma omp target teams if (S1) // expected-error {{'S1' does not refer to a value}}
70  foo();
71#pragma omp target teams if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
72  foo();
73#pragma omp target teams if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
74  foo();
75#pragma omp target teams if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
76  foo();
77#pragma omp target teams if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
78  foo();
79#pragma omp target teams if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
80  foo();
81#pragma omp target teams if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
82  foo();
83#pragma omp target teams if(target : argc)
84  foo();
85#pragma omp target teams if(target : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams'}}
86  foo();
87#pragma omp target teams if(target : argc) if (target:argc) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'if' clause with 'target' name modifier}}
88  foo();
89#pragma omp target teams if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
90  foo();
91
92  return tmain(argc, argv);
93}
94