aboutsummaryrefslogtreecommitdiff
path: root/clang
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
commit4c904adf7cf92dbf518b60acea8b7b9539649bc6 (patch)
tree97a1dc9d547247aa10e034c387ee39f330e3bde6 /clang
parent601957fa23ab90cbb24114ee9913244883453f96 (diff)
downloadllvm-4c904adf7cf92dbf518b60acea8b7b9539649bc6.zip
llvm-4c904adf7cf92dbf518b60acea8b7b9539649bc6.tar.gz
llvm-4c904adf7cf92dbf518b60acea8b7b9539649bc6.tar.bz2
[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.
llvm-svn: 213496
Diffstat (limited to 'clang')
-rw-r--r--clang/test/OpenMP/for_loop_messages.cpp14
-rw-r--r--clang/test/OpenMP/parallel_for_messages.cpp96
-rw-r--r--clang/test/OpenMP/parallel_sections_messages.cpp1
-rw-r--r--clang/test/OpenMP/sections_misc_messages.c8
-rw-r--r--clang/test/OpenMP/single_misc_messages.c5
5 files changed, 82 insertions, 42 deletions
diff --git a/clang/test/OpenMP/for_loop_messages.cpp b/clang/test/OpenMP/for_loop_messages.cpp
index deed0ec..8cc882e 100644
--- a/clang/test/OpenMP/for_loop_messages.cpp
+++ b/clang/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/clang/test/OpenMP/parallel_for_messages.cpp b/clang/test/OpenMP/parallel_for_messages.cpp
index c9f4df4..e4ea0d5 100644
--- a/clang/test/OpenMP/parallel_for_messages.cpp
+++ b/clang/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/clang/test/OpenMP/parallel_sections_messages.cpp b/clang/test/OpenMP/parallel_sections_messages.cpp
index f6ee2fc..f587509 100644
--- a/clang/test/OpenMP/parallel_sections_messages.cpp
+++ b/clang/test/OpenMP/parallel_sections_messages.cpp
@@ -83,4 +83,3 @@ int main(int argc, char **argv) {
return 0;
}
-
diff --git a/clang/test/OpenMP/sections_misc_messages.c b/clang/test/OpenMP/sections_misc_messages.c
index 977d154..0297513 100644
--- a/clang/test/OpenMP/sections_misc_messages.c
+++ b/clang/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/clang/test/OpenMP/single_misc_messages.c b/clang/test/OpenMP/single_misc_messages.c
index 8667b50..7c10ca0 100644
--- a/clang/test/OpenMP/single_misc_messages.c
+++ b/clang/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)
+ ;
+}