On Thu, Oct 14, 2021 at 11:04:59AM +0100, Kwok Cheung Yeung wrote:
> I have now dropped this. This affects test2 in
> gfortran.dg/gomp/declare-variant-8.f90, which I have added a comment to.

Thanks.

> I have added Fortran-specific tests as
> gfortran.dg/gomp/declare-variant-15.f90 to declare-variant-19.f90.

What I still miss is tests for the (proc_name : variant_name) syntax
in places where proc_name : is optional, but is supplied and is valid, like
e.g. in interface, or in subroutine/function and where proc_name specifies
the name of the containing interface or subroutine/function.
I see that syntax tested in some places with dg-error on that line and
in spaces where it isn't optional (e.g. at module scope before contains).
But if you want, that can be added incrementally.

> From ab03cf08c6ee4a0a6323189313cae911483a2257 Mon Sep 17 00:00:00 2001
> From: Kwok Cheung Yeung <k...@codesourcery.com>
> Date: Wed, 13 Oct 2021 22:39:20 +0100
> Subject: [PATCH] openmp, fortran: Add support for OpenMP declare variant
>  directive in Fortran
> 
> 2021-10-13  Kwok Cheung Yeung  <k...@codesourcery.com>
> 
> gcc/c-family/
> 
>       * c-omp.c (c_omp_check_context_selector): Rename to
>       omp_check_context_selector and move to omp-general.c.
>       (c_omp_mark_declare_variant): Rename to omp_mark_declare_variant and
>       move to omp-general.c.
> 
> gcc/c/
> 
>       * c-parser.c (c_finish_omp_declare_variant): Change call from
>       c_omp_check_context_selector to omp_check_context_selector. Change
>       call from c_omp_mark_declare_variant to omp_mark_declare_variant.
> 
> gcc/cp/
> 
>       * decl.c (omp_declare_variant_finalize_one): Change call from
>       c_omp_mark_declare_variant to omp_mark_declare_variant.
>       * parser.c (cp_finish_omp_declare_variant): Change call from
>       c_omp_check_context_selector to omp_check_context_selector.
> 
> gcc/fortran/
> 
>       * gfortran.h (enum gfc_statement): Add ST_OMP_DECLARE_VARIANT.
>       (enum gfc_omp_trait_property_kind): New.
>       (struct gfc_omp_trait_property): New.
>       (gfc_get_omp_trait_property): New macro.
>       (struct gfc_omp_selector): New.
>       (gfc_get_omp_selector): New macro.
>       (struct gfc_omp_set_selector): New.
>       (gfc_get_omp_set_selector): New macro.
>       (struct gfc_omp_declare_variant): New.
>       (gfc_get_omp_declare_variant): New macro.
>       (struct gfc_namespace): Add omp_declare_variant field.
>       (gfc_free_omp_declare_variant_list): New prototype.
>       * match.h (gfc_match_omp_declare_variant): New prototype.
>       * openmp.c (gfc_free_omp_trait_property_list): New.
>       (gfc_free_omp_selector_list): New.
>       (gfc_free_omp_set_selector_list): New.
>       (gfc_free_omp_declare_variant_list): New.
>       (gfc_match_omp_clauses): Add extra optional argument.  Handle end of
>       clauses for context selectors.
>       (omp_construct_selectors, omp_device_selectors,
>       omp_implementation_selectors, omp_user_selectors): New.
>       (gfc_match_omp_context_selector): New.
>       (gfc_match_omp_context_selector_specification): New.
>       (gfc_match_omp_declare_variant): New.
>       * parse.c: Include tree-core.h and omp-general.h.
>       (decode_omp_directive): Handle 'declare variant'.
>       (case_omp_decl): Include ST_OMP_DECLARE_VARIANT.
>       (gfc_ascii_statement): Handle ST_OMP_DECLARE_VARIANT.
>       (gfc_parse_file): Initialize omp_requires_mask.
>       * symbol.c (gfc_free_namespace): Call
>       gfc_free_omp_declare_variant_list.
>       * trans-decl.c (gfc_get_extern_function_decl): Call
>       gfc_trans_omp_declare_variant.
>       (gfc_create_function_decl): Call gfc_trans_omp_declare_variant.
>       * trans-openmp.c (gfc_trans_omp_declare_variant): New.
>       * trans-stmt.h (gfc_trans_omp_declare_variant): New prototype.
> 
> gcc/
> 
>       * omp-general.c (omp_check_context_selector):  Move from c-omp.c.
>       (omp_mark_declare_variant): Move from c-omp.c.
>       (omp_context_name_list_prop): Update for Fortran strings.
>       * omp-general.h (omp_check_context_selector): New prototype.
>       (omp_mark_declare_variant): New prototype.
> 
> gcc/testsuite/
> 
>       * gfortran.dg/gomp/declare-variant-1.f90: New test.
>       * gfortran.dg/gomp/declare-variant-10.f90: New test.
>       * gfortran.dg/gomp/declare-variant-11.f90: New test.
>       * gfortran.dg/gomp/declare-variant-12.f90: New test.
>       * gfortran.dg/gomp/declare-variant-13.f90: New test.
>       * gfortran.dg/gomp/declare-variant-14.f90: New test.
>       * gfortran.dg/gomp/declare-variant-15.f90: New test.
>       * gfortran.dg/gomp/declare-variant-16.f90: New test.
>       * gfortran.dg/gomp/declare-variant-17.f90: New test.
>       * gfortran.dg/gomp/declare-variant-18.f90: New test.
>       * gfortran.dg/gomp/declare-variant-19.f90: New test.
>       * gfortran.dg/gomp/declare-variant-2.f90: New test.
>       * gfortran.dg/gomp/declare-variant-2a.f90: New test.
>       * gfortran.dg/gomp/declare-variant-3.f90: New test.
>       * gfortran.dg/gomp/declare-variant-4.f90: New test.
>       * gfortran.dg/gomp/declare-variant-5.f90: New test.
>       * gfortran.dg/gomp/declare-variant-6.f90: New test.
>       * gfortran.dg/gomp/declare-variant-7.f90: New test.
>       * gfortran.dg/gomp/declare-variant-8.f90: New test.
>       * gfortran.dg/gomp/declare-variant-9.f90: New test.
> 
> libgomp/
> 
>       * testsuite/libgomp.fortran/declare-variant-1.f90: New test.

LGTM, thanks.

        Jakub

Reply via email to