summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-07-21 02:45:36 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-07-21 02:45:36 +0000
commit05fbd2d2d11ea55764f272ca40e8de4b18e3e389 (patch)
tree530d8014d423b81d6719941234a1cacb28c61f46
parent8dae99b9e139c485973af77abc5a6b23d81b9248 (diff)
[OPENMP] Added several test cases for clauses 'ordered' and 'nowait': if there are more than one 'nowait' or 'ordered' clause an error message is expected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213496 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/OpenMP/for_loop_messages.cpp14
-rw-r--r--test/OpenMP/parallel_for_messages.cpp96
-rw-r--r--test/OpenMP/parallel_sections_messages.cpp1
-rw-r--r--test/OpenMP/sections_misc_messages.c8
-rw-r--r--test/OpenMP/single_misc_messages.c5
5 files changed, 82 insertions, 42 deletions
diff --git a/test/OpenMP/for_loop_messages.cpp b/test/OpenMP/for_loop_messages.cpp
index deed0ec31b..8cc882e13a 100644
--- a/test/OpenMP/for_loop_messages.cpp
+++ b/test/OpenMP/for_loop_messages.cpp
@@ -678,3 +678,17 @@ void test_loop_firstprivate_lastprivate() {
for (int i = 0; i < 16; ++i)
;
}
+
+void test_ordered() {
+#pragma omp parallel
+#pragma omp for ordered ordered // expected-error {{directive '#pragma omp for' cannot contain more than one 'ordered' clause}}
+ for (int i = 0; i < 16; ++i)
+ ;
+}
+
+void test_nowait() {
+#pragma omp parallel
+#pragma omp for nowait nowait // expected-error {{directive '#pragma omp for' cannot contain more than one 'nowait' clause}}
+ for (int i = 0; i < 16; ++i)
+ ;
+}
diff --git a/test/OpenMP/parallel_for_messages.cpp b/test/OpenMP/parallel_for_messages.cpp
index c9f4df4616..e4ea0d5e2d 100644
--- a/test/OpenMP/parallel_for_messages.cpp
+++ b/test/OpenMP/parallel_for_messages.cpp
@@ -6,65 +6,81 @@ void foo() {
#pragma omp parallel for // expected-error {{unexpected OpenMP directive '#pragma omp parallel for'}}
int main(int argc, char **argv) {
- #pragma omp parallel for { // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for [ // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for ] // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for ) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for } // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for
- for(int i = 0; i < argc; ++i) foo();
- // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
- #pragma omp parallel for unknown()
- for(int i = 0; i < argc; ++i) foo();
- L1:
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for
- for(int i = 0; i < argc; ++i) foo();
- #pragma omp parallel for
- for(int i = 0; i < argc; ++i)
- {
+#pragma omp parallel for { // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for] // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for } // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for
+ for (int i = 0; i < argc; ++i)
+ foo();
+// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}}
+#pragma omp parallel for unknown()
+ for (int i = 0; i < argc; ++i)
+ foo();
+L1:
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for
+ for (int i = 0; i < argc; ++i)
+ foo();
+#pragma omp parallel for
+ for (int i = 0; i < argc; ++i) {
goto L1; // expected-error {{use of undeclared label 'L1'}}
argc++;
}
for (int i = 0; i < 10; ++i) {
- switch(argc) {
- case (0):
- #pragma omp parallel for
- for(int i = 0; i < argc; ++i)
- {
+ switch (argc) {
+ case (0):
+#pragma omp parallel for
+ for (int i = 0; i < argc; ++i) {
foo();
break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
continue;
}
- default:
- break;
+ default:
+ break;
}
}
- #pragma omp parallel for default(none)
+#pragma omp parallel for default(none)
for (int i = 0; i < 10; ++i)
- ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
+ ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
goto L2; // expected-error {{use of undeclared label 'L2'}}
- #pragma omp parallel for
- for(int i = 0; i < argc; ++i) L2:foo();
- #pragma omp parallel for
- for(int i = 0; i < argc; ++i)
- {
+#pragma omp parallel for
+ for (int i = 0; i < argc; ++i)
+ L2:
+ foo();
+#pragma omp parallel for
+ for (int i = 0; i < argc; ++i) {
return 1; // expected-error {{cannot return from OpenMP region}}
}
[[]] // expected-error {{an attribute list cannot appear here}}
- #pragma omp parallel for
- for (int n = 0; n < 100; ++n) {}
+#pragma omp parallel for
+ for (int n = 0; n < 100; ++n) {
+ }
return 0;
}
+void test_ordered() {
+#pragma omp parallel for ordered ordered // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}}
+ for (int i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/test/OpenMP/parallel_sections_messages.cpp b/test/OpenMP/parallel_sections_messages.cpp
index f6ee2fc448..f5875098e8 100644
--- a/test/OpenMP/parallel_sections_messages.cpp
+++ b/test/OpenMP/parallel_sections_messages.cpp
@@ -83,4 +83,3 @@ int main(int argc, char **argv) {
return 0;
}
-
diff --git a/test/OpenMP/sections_misc_messages.c b/test/OpenMP/sections_misc_messages.c
index 977d154156..0297513543 100644
--- a/test/OpenMP/sections_misc_messages.c
+++ b/test/OpenMP/sections_misc_messages.c
@@ -24,7 +24,6 @@ void test_no_clause() {
foo();
foo(); // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}}
}
-
}
void test_branch_protected_scope() {
@@ -291,3 +290,10 @@ void test_firstprivate() {
}
}
+void test_nowait() {
+#pragma omp parallel
+#pragma omp sections nowait nowait // expected-error {{directive '#pragma omp sections' cannot contain more than one 'nowait' clause}}
+ {
+ ;
+ }
+}
diff --git a/test/OpenMP/single_misc_messages.c b/test/OpenMP/single_misc_messages.c
index 8667b50469..7c10ca0a28 100644
--- a/test/OpenMP/single_misc_messages.c
+++ b/test/OpenMP/single_misc_messages.c
@@ -149,3 +149,8 @@ void test_firstprivate() {
foo();
}
+void test_nowait() {
+#pragma omp single nowait nowait // expected-error {{directive '#pragma omp single' cannot contain more than one 'nowait' clause}}
+ for (int i = 0; i < 16; ++i)
+ ;
+}