2020-02-07 05:30:23 +08:00
// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp -fopenmp-version=50 -ferror-limit 100 %s -Wuninitialized
2014-07-21 19:26:11 +08:00
2020-02-07 05:30:23 +08:00
// RUN: %clang_cc1 -verify=expected,omp45 -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
// RUN: %clang_cc1 -verify=expected,omp50 -fopenmp-simd -fopenmp-version=50 -ferror-limit 100 %s -Wuninitialized
2017-12-30 02:07:07 +08:00
2014-07-21 19:26:11 +08:00
struct S1 { // expected-note 2 {{declared here}}
int a ;
} ;
template < class T >
T tmain ( T argc ) {
2019-03-27 22:14:31 +08:00
# pragma omp flush allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp flush'}}
2014-07-21 19:26:11 +08:00
;
# pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}
# pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
if ( argc )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
if ( argc ) {
# pragma omp flush
}
while ( argc )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
while ( argc ) {
# pragma omp flush
}
do
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
while ( argc )
;
do {
# pragma omp flush
} while ( argc ) ;
switch ( argc )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
switch ( argc )
case 1 :
2019-02-15 08:27:53 +08:00
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
2014-07-21 19:26:11 +08:00
switch ( argc )
case 1 : {
# pragma omp flush
}
switch ( argc ) {
# pragma omp flush
case 1 :
2016-01-13 19:18:54 +08:00
# pragma omp flush
2014-07-21 19:26:11 +08:00
break ;
default : {
# pragma omp flush
} break ;
}
for ( ; ; )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
for ( ; ; ) {
# pragma omp flush
}
label :
2019-02-15 08:27:53 +08:00
# pragma omp flush
2014-07-21 19:26:11 +08:00
label1 : {
# pragma omp flush
}
# pragma omp flush
# pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
# pragma omp flush() // expected-error {{expected expression}}
# pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
2016-04-01 16:43:42 +08:00
# pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2014-07-21 19:26:11 +08:00
# pragma omp flush(argc)
# pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}}
# pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
# pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
;
return T ( ) ;
}
int main ( int argc , char * * argv ) {
# pragma omp flush
;
# pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}}
# pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
if ( argc )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
if ( argc ) {
# pragma omp flush
}
while ( argc )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
while ( argc ) {
# pragma omp flush
}
do
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
while ( argc )
;
do {
# pragma omp flush
} while ( argc ) ;
switch ( argc )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
switch ( argc )
case 1 :
2019-02-15 08:27:53 +08:00
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
2014-07-21 19:26:11 +08:00
switch ( argc )
case 1 : {
# pragma omp flush
}
switch ( argc ) {
# pragma omp flush
case 1 :
2016-01-13 19:18:54 +08:00
# pragma omp flush
2014-07-21 19:26:11 +08:00
break ;
default : {
# pragma omp flush
} break ;
}
for ( ; ; )
# pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}}
for ( ; ; ) {
# pragma omp flush
}
label :
2019-02-15 08:27:53 +08:00
# pragma omp flush
2014-07-21 19:26:11 +08:00
label1 : {
# pragma omp flush
}
# pragma omp flush
# pragma omp flush( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
# pragma omp flush() // expected-error {{expected expression}}
# pragma omp flush(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
2016-04-01 16:43:42 +08:00
# pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
2014-07-21 19:26:11 +08:00
# pragma omp flush(argc)
# pragma omp flush(S1) // expected-error {{'S1' does not refer to a value}}
# pragma omp flush(argc) flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}}
# pragma omp parallel flush(argc) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
;
2020-02-07 05:30:23 +08:00
# pragma omp flush seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp flush'}}
# pragma omp flush acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}}
2020-02-11 03:30:39 +08:00
# pragma omp flush acquire // omp45-error {{unexpected OpenMP clause 'acquire' in directive '#pragma omp flush'}}
2020-02-11 04:49:05 +08:00
# pragma omp flush release // omp45-error {{unexpected OpenMP clause 'release' in directive '#pragma omp flush'}}
2020-02-12 00:10:43 +08:00
# pragma omp flush relaxed // expected-error {{unexpected OpenMP clause 'relaxed' in directive '#pragma omp flush'}}
# pragma omp flush seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp flush'}}
2020-02-11 04:49:05 +08:00
# 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'}} omp50-error {{directive '#pragma omp flush' cannot contain more than one 'acq_rel', 'acquire' or 'release' clause}} omp50-note {{'acq_rel' clause used here}}
# 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'}} omp50-error {{directive '#pragma omp flush' cannot contain more than one 'acq_rel', 'acquire' or 'release' clause}} omp50-note {{'release' clause used here}}
2020-02-28 22:52:15 +08:00
# 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}}
2020-02-07 05:30:23 +08:00
# pragma omp flush(argc) acq_rel // omp45-error {{unexpected OpenMP clause 'acq_rel' in directive '#pragma omp flush'}} omp50-error {{'flush' directive with memory order clause 'acq_rel' cannot have the list}} omp50-note {{memory order clause 'acq_rel' is specified here}}
2014-07-21 19:26:11 +08:00
return tmain ( argc ) ;
}