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