[PATCH v3 01/12] OpenMP: metadirective tree data structures and front-end interfaces

Jakub Jelinek jakub@redhat.com
Fri Aug 9 16:42:15 GMT 2024


On Sat, Jul 20, 2024 at 02:42:20PM -0600, Sandra Loosemore wrote:
> +static tree
> +omp_encode_kind_arch_isa_props (tree props)
> +{
> +  if (!props)
> +    return NULL_TREE;
> +  size_t length = 1;
> +  for (tree p = props; p; p = TREE_CHAIN (p))
> +    length += strlen (omp_context_name_list_prop (p)) + 1;
> +  char *buffer = (char *) alloca (length);

This should be
  char *buffer = XALLOCAVEC (char, length);

> +	/* Generate
> +	     devnum = (num == -1) ? GOMP_DEVICE_HOST_FALLBACK : num);
> +	   to remap -1 for GOMP_* functions.  */

In the comment there are 2 closing parens vs. one opening, should
the one before ; be dropped?

> @@ -150,6 +166,15 @@ extern tree make_trait_set_selector (enum omp_tss_code, tree, tree);
>  extern tree make_trait_selector (enum omp_ts_code, tree, tree, tree);
>  extern tree make_trait_property (tree, tree, tree);
>  
> +/* Accessors and constructor for metadirective variants.  */
> +#define OMP_METADIRECTIVE_VARIANT_SELECTOR(v) \
> +  TREE_PURPOSE (v)
> +#define OMP_METADIRECTIVE_VARIANT_DIRECTIVE(v) \
> +  TREE_PURPOSE (TREE_VALUE (v))
> +#define OMP_METADIRECTIVE_VARIANT_BODY(v) \
> +  TREE_VALUE (TREE_VALUE (v))

I think the above macros should go to tree.h after OMP_METADIRECTIVE_VARIANTS
definition, not in this header (plus the docs adjusted not to talk about
omp-general.h).

Why needs omp-general.h the move in GTFILES etc.?  Will just moving
those definitions be ok?

Otherwise LGTM.

	Jakub



More information about the Gcc-patches mailing list