On Wed, May 20, 2015 at 10:23:21AM +0200, Thomas Schwinge wrote: > > + if (gwv && auto_clause) > > + c_parser_error (parser, "incompatible use of clause %<auto%>"); > > + else if (gwv && seq_clause) > > + c_parser_error (parser, "incompatible use of clause %<seq%>"); > > + else if (auto_clause && seq_clause) > > + c_parser_error (parser, "incompatible use of clause %<seq%> and > > %<auto%>"); > > + > > block = c_begin_compound_stmt (true); > > stmt = c_parser_omp_for_loop (loc, parser, OACC_LOOP, clauses, NULL); > > block = c_end_compound_stmt (loc, block, true); > > I would have expected such checking to be done in c_omp_finish_clauses -- > But maybe it's also OK to do it here, given that the loop construct is > the only one where these clauses can appear. Jakub, any strong > preference?
In the C FE, it is kind of arbitrary, some checks are done during parsing immediately, others are done in c_omp_finish_clauses. In the C++ FE, obviously more care on where things are diagnosed is needed, so many more checks are done in finish_omp_clauses, because we might want to wait until templates are instantiated. > > ..., and this: why not do such nesting checking in > gcc/omp-low.c:check_omp_nesting_restrictions? Currently (changed by > Bernd in internal r442824, 2014-11-29) we're allowing all > OpenACC-inside-OpenACC nesting -- shouldn't that be changed instead of > repeating the checks in every front end (Jakub?)? Yeah, testing nesting restrictions should be done in omp-low.c if possible. Adding ugly hacks to the FEs tracking the current state and duplicating across all 3 FEs is undesirable. Note, in C++ FE we already have sk_omp so some kind of OpenMP binding scope, but I think we don't have anything similar in the C FE. > I see that some checking is also being done gcc/omp-low.c:scan_omp_for: > »gang, worker and vector may occur only once in a loop nest«, and »gang, > worker and vector must occur in this order in a loop nest«. Don't know > if that conceptually also belongs into > gcc/omp-low.c:check_omp_nesting_restrictions? Doesn't look like anything related to construct/region nesting... Jakub