OmpClause::DEVICE, OmpClause::DEFAULTMAP, OmpClause::NOWAIT};
SetContextAllowedOnce(allowedOnce);
} break;
+ case parser::OmpBlockDirective::Directive::Teams: {
+ PushContext(beginDir.source, OmpDirective::TEAMS);
+ OmpClauseSet allowed{OmpClause::PRIVATE, OmpClause::FIRSTPRIVATE,
+ OmpClause::SHARED, OmpClause::REDUCTION};
+ SetContextAllowed(allowed);
+ OmpClauseSet allowedOnce{
+ OmpClause::NUM_TEAMS, OmpClause::THREAD_LIMIT, OmpClause::DEFAULT};
+ SetContextAllowedOnce(allowedOnce);
+ } break;
default:
// TODO others
break;
CheckAllowed(OmpClause::NUM_TASKS);
RequiresPositiveParameter(OmpClause::NUM_TASKS, x.v);
}
-void OmpStructureChecker::Enter(const parser::OmpClause::NumTeams &) {
+void OmpStructureChecker::Enter(const parser::OmpClause::NumTeams &x) {
CheckAllowed(OmpClause::NUM_TEAMS);
+ RequiresPositiveParameter(OmpClause::NUM_TEAMS, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::NumThreads &x) {
CheckAllowed(OmpClause::NUM_THREADS);
CheckAllowed(OmpClause::SIMDLEN);
RequiresConstantPositiveParameter(OmpClause::SIMDLEN, x.v);
}
-void OmpStructureChecker::Enter(const parser::OmpClause::ThreadLimit &) {
+void OmpStructureChecker::Enter(const parser::OmpClause::ThreadLimit &x) {
CheckAllowed(OmpClause::THREAD_LIMIT);
+ RequiresPositiveParameter(OmpClause::THREAD_LIMIT, x.v);
}
void OmpStructureChecker::Enter(const parser::OmpClause::To &) {
CheckAllowed(OmpClause::TO);
enddo
!$omp end target
+ !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
+ do i = 1, N
+ a = 3.14
+ enddo
+ !$omp end teams
+
+ !ERROR: At most one NUM_TEAMS clause can appear on the TEAMS directive
+ !$omp teams num_teams(2) num_teams(3)
+ do i = 1, N
+ a = 3.14
+ enddo
+ !$omp end teams
+
+ !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
+ !$omp teams num_teams(-1)
+ do i = 1, N
+ a = 3.14
+ enddo
+ !$omp end teams
+
+ !ERROR: At most one THREAD_LIMIT clause can appear on the TEAMS directive
+ !$omp teams thread_limit(2) thread_limit(3)
+ do i = 1, N
+ a = 3.14
+ enddo
+ !$omp end teams
+
+ !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
+ !$omp teams thread_limit(-1)
+ do i = 1, N
+ a = 3.14
+ enddo
+ !$omp end teams
+
+ !ERROR: At most one DEFAULT clause can appear on the TEAMS directive
+ !$omp teams default(shared) default(none)
+ do i = 1, N
+ a = 3.14
+ enddo
+ !$omp end teams
+
end program main