diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-21 11:26:11 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-21 11:26:11 +0000 |
commit | 6125da9258e6e070b5188a30715eef9e6e695f71 (patch) | |
tree | 1ff7bb0c664c8c49576f4e09338dc3303daaea6b /clang/test/OpenMP/flush_messages.cpp | |
parent | d7c279604551c091290fc8e5dadb26142ebef459 (diff) | |
download | bcm5719-llvm-6125da9258e6e070b5188a30715eef9e6e695f71.tar.gz bcm5719-llvm-6125da9258e6e070b5188a30715eef9e6e695f71.zip |
[OPENMP] Initial parsing and sema analysis for 'flush' directive.
llvm-svn: 213512
Diffstat (limited to 'clang/test/OpenMP/flush_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/flush_messages.cpp | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/clang/test/OpenMP/flush_messages.cpp b/clang/test/OpenMP/flush_messages.cpp new file mode 100644 index 00000000000..8c61680929a --- /dev/null +++ b/clang/test/OpenMP/flush_messages.cpp @@ -0,0 +1,134 @@ +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s + +struct S1 { // expected-note 2 {{declared here}} + int a; +}; + +template <class T> +T tmain(T argc) { +#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: +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} + switch (argc) + case 1: { +#pragma omp flush + } + switch (argc) { +#pragma omp flush + case 1: +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} + 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: +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} +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 '('}} +#pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#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: +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} + switch (argc) + case 1: { +#pragma omp flush + } + switch (argc) { +#pragma omp flush + case 1: +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} + 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: +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} +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 '('}} +#pragma omp flush(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#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 tmain(argc); +} |