r213496 - [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.

Alexey Bataev a.bataev at hotmail.com
Sun Jul 20 19:45:36 PDT 2014


Author: abataev
Date: Sun Jul 20 21:45:36 2014
New Revision: 213496

URL: http://llvm.org/viewvc/llvm-project?rev=213496&view=rev
Log:
[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.

Modified:
    cfe/trunk/test/OpenMP/for_loop_messages.cpp
    cfe/trunk/test/OpenMP/parallel_for_messages.cpp
    cfe/trunk/test/OpenMP/parallel_sections_messages.cpp
    cfe/trunk/test/OpenMP/sections_misc_messages.c
    cfe/trunk/test/OpenMP/single_misc_messages.c

Modified: cfe/trunk/test/OpenMP/for_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_loop_messages.cpp?rev=213496&r1=213495&r2=213496&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_loop_messages.cpp Sun Jul 20 21:45:36 2014
@@ -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)
+    ;
+}

Modified: cfe/trunk/test/OpenMP/parallel_for_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_messages.cpp?rev=213496&r1=213495&r2=213496&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_messages.cpp Sun Jul 20 21:45:36 2014
@@ -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 at +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 at +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)
+    ;
+}
+

Modified: cfe/trunk/test/OpenMP/parallel_sections_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_messages.cpp?rev=213496&r1=213495&r2=213496&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_sections_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_sections_messages.cpp Sun Jul 20 21:45:36 2014
@@ -83,4 +83,3 @@ int main(int argc, char **argv) {
 
   return 0;
 }
-

Modified: cfe/trunk/test/OpenMP/sections_misc_messages.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/sections_misc_messages.c?rev=213496&r1=213495&r2=213496&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/sections_misc_messages.c (original)
+++ cfe/trunk/test/OpenMP/sections_misc_messages.c Sun Jul 20 21:45:36 2014
@@ -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}}
+  {
+    ;
+  }
+}

Modified: cfe/trunk/test/OpenMP/single_misc_messages.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/single_misc_messages.c?rev=213496&r1=213495&r2=213496&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/single_misc_messages.c (original)
+++ cfe/trunk/test/OpenMP/single_misc_messages.c Sun Jul 20 21:45:36 2014
@@ -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)
+    ;
+}





More information about the cfe-commits mailing list