Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / parallel_for_if_messages.cpp
blob7c49406cd64cebb68af1547f4e3043395fbd584c
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -Wuninitialized
6 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s -Wuninitialized
8 void foo() {
11 bool foobool(int argc) {
12 return argc;
15 void xxx(int argc) {
16 int cond; // expected-note {{initialize the variable 'cond' to silence this warning}}
17 #pragma omp parallel for if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
18 for (int i = 0; i < 10; ++i)
22 struct S1; // expected-note {{declared here}}
24 template <class T, class S> // expected-note {{declared here}}
25 int tmain(T argc, S **argv) {
26 T i, z;
27 #pragma omp parallel for if // expected-error {{expected '(' after 'if'}}
28 for (i = 0; i < argc; ++i) foo();
29 #pragma omp parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
30 for (i = 0; i < argc; ++i) foo();
31 #pragma omp parallel for if () // expected-error {{expected expression}}
32 for (i = 0; i < argc; ++i) foo();
33 #pragma omp parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
34 for (i = 0; i < argc; ++i) foo();
35 #pragma omp parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
36 for (i = 0; i < argc; ++i) foo();
37 #pragma omp parallel for if (argc > 0 ? argv[1] : argv[2])
38 for (i = 0; i < argc; ++i) foo();
39 #pragma omp parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'if' clause}}
40 for (i = 0; i < argc; ++i) foo();
41 #pragma omp parallel for if (S) // expected-error {{'S' does not refer to a value}}
42 for (i = 0; i < argc; ++i) foo();
43 #pragma omp parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
44 for (i = 0; i < argc; ++i) foo();
45 #pragma omp parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
46 for (i = 0; i < argc; ++i) foo();
47 #pragma omp parallel for if(argc/z)
48 for (i = 0; i < argc; ++i) foo();
49 #pragma omp parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
50 for (i = 0; i < argc; ++i) foo();
51 #pragma omp parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
52 for (i = 0; i < argc; ++i) foo();
53 #pragma omp parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
54 for (i = 0; i < argc; ++i) foo();
55 #pragma omp parallel for if(parallel : argc)
56 for (i = 0; i < argc; ++i) foo();
57 #pragma omp parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel for'}}
58 for (i = 0; i < argc; ++i) foo();
59 #pragma omp parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
60 for (i = 0; i < argc; ++i) foo();
61 #pragma omp parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
62 for (i = 0; i < argc; ++i) foo();
64 return 0;
67 int main(int argc, char **argv) {
68 int i,z;
69 #pragma omp parallel for if // expected-error {{expected '(' after 'if'}}
70 for (i = 0; i < argc; ++i) foo();
71 #pragma omp parallel for if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
72 for (i = 0; i < argc; ++i) foo();
73 #pragma omp parallel for if () // expected-error {{expected expression}}
74 for (i = 0; i < argc; ++i) foo();
75 #pragma omp parallel for if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
76 for (i = 0; i < argc; ++i) foo();
77 #pragma omp parallel for if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
78 for (i = 0; i < argc; ++i) foo();
79 #pragma omp parallel for if (argc > 0 ? argv[1] : argv[2])
80 for (i = 0; i < argc; ++i) foo();
81 #pragma omp parallel for if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'if' clause}}
82 for (i = 0; i < argc; ++i) foo();
83 #pragma omp parallel for if (S1) // expected-error {{'S1' does not refer to a value}}
84 for (i = 0; i < argc; ++i) foo();
85 #pragma omp parallel for if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
86 for (i = 0; i < argc; ++i) foo();
87 #pragma omp parallel for if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
88 for (i = 0; i < argc; ++i) foo();
89 #pragma omp parallel for if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
90 for (i = 0; i < argc; ++i) foo();
91 #pragma omp parallel for if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
92 for (i = 0; i < argc; ++i) foo();
93 #pragma omp parallel for if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
94 for (i = 0; i < argc; ++i) foo();
95 #pragma omp parallel for if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
96 for (i = 0; i < argc; ++i) foo();
97 #pragma omp parallel for if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
98 for (i = 0; i < argc; ++i) foo();
99 #pragma omp parallel for if(parallel : z*argc)
100 for (i = 0; i < argc; ++i) foo();
101 #pragma omp parallel for if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel for'}}
102 for (i = 0; i < argc; ++i) foo();
103 #pragma omp parallel for if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'if' clause with 'parallel' name modifier}}
104 for (i = 0; i < argc; ++i) foo();
105 #pragma omp parallel for if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
106 for (i = 0; i < argc; ++i) foo();
108 return tmain(argc, argv);