> New common C/C++ testcases are in a separate patch.
>
> gcc/c-family/ChangeLog
> * c-common.h (c_omp_check_loop_binding_exprs): Declare.
> * c-omp.cc: Include tree-iterator.h.
> (find_binding_in_body): New.
> (check_loop_binding_expr_r): New.
> (LOCATION_OR): New.
> (check_looop_binding_expr): New.
> (c_omp_check_loop_binding_exprs): New.
>
> gcc/c/ChangeLog
> * c-parser.cc (struct c_parser): Add omp_for_parse_state field.
> (struct omp_for_parse_data): New.
> (check_omp_intervening_code): New.
> (add_structured_block_stmt): New.
> (c_parser_compound_statement_nostart): Recognize intervening code,
> nested loops, and other things that need special handling in
> OpenMP loop constructs.
> (c_parser_while_statement): Error on loop in intervening code.
> (c_parser_do_statement): Likewise.
> (c_parser_for_statement): Likewise.
> (c_parser_postfix_expression_after_primary): Error on calls to
> the OpenMP runtime in intervening code.
> (c_parser_pragma): Error on OpenMP pragmas in intervening code.
> (c_parser_omp_loop_nest): New.
> (c_parser_omp_for_loop): Rewrite to use recursive descent, calling
> c_parser_omp_loop_nest to do the heavy lifting.
>
> gcc/ChangeLog
> * omp-api.h: New.
> * omp-general.cc (omp_runtime_api_procname): New.
> (omp_runtime_api_call): Moved here from omp-low.cc, and make
> non-static.
> * omp-general.h: Include omp-api.h.
> * omp-low.cc (omp_runtime_api_call): Delete this copy.
>
> gcc/testsuite/ChangeLog
> * c-c++-common/goacc/collapse-1.c: Update for new C error behavior.
> * c-c++-common/goacc/tile-2.c: Likewise.
> * gcc.dg/gomp/collapse-1.c: Likewise.
> diff --git a/gcc/testsuite/c-c++-common/goacc/collapse-1.c
> b/gcc/testsuite/c-c++-common/goacc/collapse-1.c
> index 11b14383983..0feac8f8ddb 100644
> --- a/gcc/testsuite/c-c++-common/goacc/collapse-1.c
> +++ b/gcc/testsuite/c-c++-common/goacc/collapse-1.c
> @@ -8,8 +8,8 @@ f1 (void)
> {
> #pragma acc parallel
> #pragma acc loop collapse (2)
> - for (i = 0; i < 5; i++)
> - ; /* { dg-error "not enough
> perfectly nested" } */
> + for (i = 0; i < 5; i++) /* { dg-error "not enough nested loops" } */
> + ;
> {
> for (j = 0; j < 5; j++)
> ;
All these c-c++-common testsuite changes will now FAIL after the C patch but
before the C++. It is nice to have the new c-c++-common tests in a separate
patch, but these tweaks which can't be just avoided need the temporary
{ target c } vs. { target c++} hacks undone later in the C++ patch.
> --- a/gcc/testsuite/c-c++-common/goacc/tile-2.c
> +++ b/gcc/testsuite/c-c++-common/goacc/tile-2.c
> @@ -3,8 +3,8 @@ int main ()
> #pragma acc parallel
> {
> #pragma acc loop tile (*,*)
> - for (int ix = 0; ix < 30; ix++)
> - ; /* { dg-error "not enough" } */
> + for (int ix = 0; ix < 30; ix++) /* { dg-error "not enough" "" { target c
> } } */
> + ; /* { dg-error "not enough" "" { target c++ } } */
E.g. like you do here.
Otherwise LGTM.
Jakub