On Tue, Apr 28, 2015 at 08:45:50PM +0200, Thomas Schwinge wrote: > I guess nobody so far ;-) has been using OpenMP's target update directive > in templated code -- OK to commit the following, and to which branches > (4.9, 5, trunk)?
Seems I've missed testcases for target {,update,data} in templates indeed, generally for C++ I'm trying to add testcases for templates, both when relevant types are type dependent and whey aren't. > gcc/cp/ > * pt.c (tsubst_expr) <OMP_TARGET_UPDATE>: Use > OMP_TARGET_UPDATE_CLAUSES instead of OMP_CLAUSES. > gcc/testsuite/ > * g++.dg/gomp/tpl-target-update.C: New file. This is ok for trunk, 5.2 and 4.9.3, thanks for fixing that. > That said, what is the preferred approach to add support for > OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE? I'm not sure hard-coding > TREE_OPERAND (t, 0) in gcc/cp/pt.c:tsubst_expr is the way to go, and also > duplicating the OMP_TARGET_UPDATE code for each of the three OACC_* > doesn't sound appealing -- especially given that we just "switch"ed on > the respective tree code, so the O*_CHECK of the respective O*_CLAUSES > macro is completely redundant. Is it OK to extend gcc/tree.h:OMP_CLAUSES > so that it can also be used for tree codes that keep clauses in operand > 0, and then use that here (and also in > gcc/gimplify.c:gimplify_omp_target_update, for example)? How could it work when it is operand 1 on some and operand 0 in others. IMHO, if you want to reuse the same code for OMP_TARGET_UPDATE, various OACC_* standalone directives (and OMP_TARGET_ENTER_DATA/OMP_TARGET_EXIT_DATA in OpenMP 4.1), then you should make sure they are consecutive in target.def and define OMP_STANDALONE_CLAUSES or OMP_TARGET_STANDALONE_CLAUSES as a range check between OMP_TARGET_UPDATE and the last OpenACC directive without body, just clauses. Jakub