brintos

brintos / llvm-project-archived public Read only

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