On 11/10/2015 12:16 AM, Jakub Jelinek wrote: > On Mon, Nov 09, 2015 at 09:28:47PM -0800, Cesar Philippidis wrote: >> Here's the patch that Nathan was referring to. I ended up introducing a >> boolean variable named first in the various functions which call >> finalize_oacc_routines. The problem the original approach was having was >> that the routine clauses is only applied to the first function >> declarator in a declaration list. By using 'first', which is set to true >> if the current declarator is the first in a sequence of declarators, I >> was able to defer setting parser->oacc_routine to NULL. > > The #pragma omp declare simd has identical restrictions, but doesn't need > to add any of the first parameters to the C++ parser. > So, what are you doing differently that you need it? Handling both > differently is a consistency issue, and unnecessary additional complexity to > the parser. I reworked how acc routines are handed in this patch to be more similar to #pragma omp declare simd. Things get kind of messy though. For starters, I had to add a new tree clauses member to cp_omp_declare_simd_data. This serves two purposes: * It allows the c++ FE to record the location of the first #pragma acc routine, which is nice because it allows test cases to be shared with the c FE. * Unlike omp declare simd, only one acc routine may be associated with a function decl. This meant that I had to defer attaching the acc geometry and 'omp target' attributes to cp_finalize_oacc_routine instead of in cp_parser_late_parsing_oacc_routine like in omp. So what happens is, cp_parser_late_parsing_oacc_routine ends up creating a function geometry clause. I don't really like this approach. I did try to postpone parsing the clauses till cp_finalize_oacc_routine, but that got messy. Plus, while I'd be able to remove the clauses field from cp_omp_declare_simd_data, we'd still need a location_t field for cp_ensure_no_oacc_routine. Is this OK for trunk? Cesar