1651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s 2651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 3651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesvoid foo() { 4651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines} 5651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 6651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesbool foobool(int argc) { 7651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines return argc; 8651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines} 9651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 10651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesstruct S1; // expected-note {{declared here}} 11651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 12651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinestemplate <class T, class S> // expected-note {{declared here}} 13651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesint tmain(T argc, S **argv) { 14651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if // expected-error {{expected '(' after 'if'}} 15651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 16651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if () // expected-error {{expected expression}} 17651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 18651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 19651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc > 0 ? argv[1] : argv[2]) 20651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause}} 21651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (S) // expected-error {{'S' does not refer to a value}} 22651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 23651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 24651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if(argc) 25651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines foo(); 26651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 27651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines return 0; 28651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines} 29651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 30651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesint main(int argc, char **argv) { 31651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if // expected-error {{expected '(' after 'if'}} 32651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 33651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if () // expected-error {{expected expression}} 34651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 35651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} 36651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc > 0 ? argv[1] : argv[2]) 37651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause}} 38651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (S1) // expected-error {{'S1' does not refer to a value}} 39651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} 40651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 41651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} 42651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines #pragma omp parallel if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 43651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines foo(); 44651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 45651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines return tmain(argc, argv); 46651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines} 47