c++: omp reduction cleanups

Nathan Sidwell nathan@acm.org
Wed Sep 9 19:36:59 GMT 2020


omp reductions are modeled as nested functions, which is a thing C++
doesn't have.  Leading to much confusion until I figured out what was
happening.  Not helped by some duplicate code and inconsistencies in
the dependent and non-dependent paths.  This patch removes the parser
duplication and fixes up some bookkeeping.  Added some asserts and
comments too.

         gcc/cp/
         * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
         code duplication.  Update DECL_TI_TEMPLATE's context.
         * pt.c (tsubst_expr): For OMP reduction function, set context to
         global_namespace before pushing.
         (tsubst_omp_udr): Assert current_function_decl, add comment about
         decl context.

pushing to trunk

nathan
-- 
Nathan Sidwell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omp.diff
Type: text/x-patch
Size: 2982 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200909/8c680332/attachment-0001.bin>


More information about the Gcc-patches mailing list