147 lines · cpp
1// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized2// RUN: %clang_cc1 -verify=expected,omp51 -fopenmp -ferror-limit 100 %s -Wuninitialized3 4// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized5// RUN: %clang_cc1 -verify=expected,omp51 -fopenmp-simd -ferror-limit 100 %s -Wuninitialized6 7struct S1 { // expected-note 2 {{declared here}}8 int a;9};10 11template <class T>12T tmain(T argc) {13#pragma omp flush allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp flush'}}14 ;15#pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}16#pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}17 if (argc)18#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}19 if (argc) {20#pragma omp flush21 }22 while (argc)23#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}24 while (argc) {25#pragma omp flush26 }27 do28#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}29 while (argc)30 ;31 do {32#pragma omp flush33 } while (argc);34 switch (argc)35#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}36 switch (argc)37 case 1:38#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}39 switch (argc)40 case 1: {41#pragma omp flush42 }43 switch (argc) {44#pragma omp flush45 case 1:46#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}47 break;48 default: {49#pragma omp flush50 } break;51 }52 for (;;)53#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}54 for (;;) {55#pragma omp flush56 }57label:58#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}59label1 : {60#pragma omp flush61}62 63#pragma omp flush64#pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}65#pragma omp flush() // expected-error {{expected expression}}66#pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}67#pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}68#pragma omp flush(argc)69#pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}}70#pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}71#pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}72 ;73 return T();74}75 76int main(int argc, char **argv) {77#pragma omp flush78 ;79#pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}80#pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}81 if (argc)82#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}83 if (argc) {84#pragma omp flush85 }86 while (argc)87#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}88 while (argc) {89#pragma omp flush90 }91 do92#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}93 while (argc)94 ;95 do {96#pragma omp flush97 } while (argc);98 switch (argc)99#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}100 switch (argc)101 case 1:102#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}103 switch (argc)104 case 1: {105#pragma omp flush106 }107 switch (argc) {108#pragma omp flush109 case 1:110#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}111 break;112 default: {113#pragma omp flush114 } break;115 }116 for (;;)117#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}118 for (;;) {119#pragma omp flush120 }121label:122#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}123label1 : {124#pragma omp flush125}126 127#pragma omp flush128#pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}129#pragma omp flush() // expected-error {{expected expression}}130#pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}131#pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}132#pragma omp flush(argc)133#pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}}134#pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}135#pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}136 ;137#pragma omp flush acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}}138#pragma omp flush acquire // omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}}139#pragma omp flush release // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}}140#pragma omp flush relaxed // expected-error {{unexpected OpenMP clause 'relaxed' in directive '#pragma omp flush'}}141#pragma omp flush acq_rel acquire // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} omp51-error {{directive '#pragma omp flush' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp51-note {{'acq_rel' clause used here}}142#pragma omp flush release acquire // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}} omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}} omp51-error {{directive '#pragma omp flush' cannot contain more than one 'seq_cst', 'acq_rel', 'acquire' or 'release' clause}} omp51-note {{'release' clause used here}}143#pragma omp flush acq_rel (argc) // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}144#pragma omp flush(argc) acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp51-error {{'flush' directive with memory order clause 'acq_rel' cannot have the list}} omp51-note {{memory order clause 'acq_rel' is specified here}}145 return tmain(argc);146}147