xref: /llvm-project/clang/test/OpenMP/for_order_messages.cpp (revision 0c6f2f629cc0017361310fa4c132090413a874db)
1*0c6f2f62SAnimesh Kumar // RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -triple x86_64-unknown-unknown -verify=expected,omp50 %s -Wuninitialized
2*0c6f2f62SAnimesh Kumar // RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -verify=expected,omp51 %s -Wuninitialized
37c34e74cSChi Chun Chen 
4*0c6f2f62SAnimesh Kumar // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -triple x86_64-unknown-unknown -verify=expected,omp50 %s -Wuninitialized
5*0c6f2f62SAnimesh Kumar // RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -verify=expected,omp51 %s -Wuninitialized
67c34e74cSChi Chun Chen 
77c34e74cSChi Chun Chen extern int omp_get_num_threads  (void);
87c34e74cSChi Chun Chen 
main(int argc,char ** argv)97c34e74cSChi Chun Chen int main(int argc, char **argv) {
107c34e74cSChi Chun Chen   int A = 0;
117c34e74cSChi Chun Chen #pragma omp parallel for order(concurrent)
127c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i)
137c34e74cSChi Chun Chen     omp_get_num_threads(); // omp51-error {{calls to OpenMP runtime API are not allowed within a region that corresponds to a construct with an order clause that specifies concurrent}}
147c34e74cSChi Chun Chen 
157c34e74cSChi Chun Chen #pragma omp parallel for order(reproducible:concurrent) // omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
167c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i)
177c34e74cSChi Chun Chen     omp_get_num_threads(); // omp51-error {{calls to OpenMP runtime API are not allowed within a region that corresponds to a construct with an order clause that specifies concurrent}}
187c34e74cSChi Chun Chen 
197c34e74cSChi Chun Chen #pragma omp parallel for order(unconstrained:concurrent) // omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
207c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i)
217c34e74cSChi Chun Chen     omp_get_num_threads(); // omp51-error {{calls to OpenMP runtime API are not allowed within a region that corresponds to a construct with an order clause that specifies concurrent}}
227c34e74cSChi Chun Chen 
237c34e74cSChi Chun Chen #pragma omp parallel for order(concurrent)
247c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i) {
257c34e74cSChi Chun Chen     for (int j = 0; j < 10; ++j) {
267c34e74cSChi Chun Chen       omp_get_num_threads(); // omp51-error {{calls to OpenMP runtime API are not allowed within a region that corresponds to a construct with an order clause that specifies concurrent}}
277c34e74cSChi Chun Chen     }
287c34e74cSChi Chun Chen   }
297c34e74cSChi Chun Chen 
307c34e74cSChi Chun Chen #pragma omp parallel for order(concurrent)
317c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i) {
327c34e74cSChi Chun Chen #pragma omp atomic //omp51-error {{construct 'atomic' not allowed in a region associated with a directive with 'order' clause}}
337c34e74cSChi Chun Chen       A++;
347c34e74cSChi Chun Chen   }
357c34e74cSChi Chun Chen 
367c34e74cSChi Chun Chen #pragma omp parallel for order(reproducible: concurrent) // omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
377c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i) {
387c34e74cSChi Chun Chen #pragma omp target //omp51-error {{construct 'target' not allowed in a region associated with a directive with 'order' clause}}
397c34e74cSChi Chun Chen       A++;
407c34e74cSChi Chun Chen   }
417c34e74cSChi Chun Chen 
427c34e74cSChi Chun Chen #pragma omp parallel for order(unconstrained: concurrent) // omp50-error {{expected 'concurrent' in OpenMP clause 'order'}}
437c34e74cSChi Chun Chen   for (int i = 0; i < 10; ++i) {
447c34e74cSChi Chun Chen #pragma omp target //omp51-error {{construct 'target' not allowed in a region associated with a directive with 'order' clause}}
457c34e74cSChi Chun Chen       A++;
467c34e74cSChi Chun Chen   }
477c34e74cSChi Chun Chen }
48