On Wed, Oct 21, 2015 at 03:16:20PM -0400, Nathan Sidwell wrote:
> 2015-10-20  Cesar Philippidis  <ce...@codesourcery.com>
>           Thomas Schwinge  <tho...@codesourcery.com>
>           James Norris  <jnor...@codesourcery.com>
>           Joseph Myers  <jos...@codesourcery.com>
>           Julian Brown  <jul...@codesourcery.com>
> 
>       * c-parser.c (c_parser_oacc_shape_clause): New.
>       (c_parser_oacc_simple_clause): New.
>       (c_parser_oacc_all_clauses): Add auto, gang, seq, vector, worker.
>       (OACC_LOOP_CLAUSE_MASK): Add gang, worker, vector, auto, seq.

Ok, with one nit.

>  /* OpenACC:
> +   gang [( gang_expr_list )]
> +   worker [( expression )]
> +   vector [( expression )] */
> +
> +static tree
> +c_parser_oacc_shape_clause (c_parser *parser, pragma_omp_clause c_kind,
> +                         const char *str, tree list)

I think it would be better to remove the c_kind argument and pass to this
function omp_clause_code kind instead.  The callers are already in a big
switch, with a separate call for each of the clauses.
After all, e.g. for c_parser_oacc_simple_clause you already do it that way
too.

> +{
> +  omp_clause_code kind;
> +  const char *id = "num";
> +
> +  switch (c_kind)
> +    {
> +    default:
> +      gcc_unreachable ();
> +    case PRAGMA_OACC_CLAUSE_GANG:
> +      kind = OMP_CLAUSE_GANG;
> +      break;
> +    case PRAGMA_OACC_CLAUSE_VECTOR:
> +      kind = OMP_CLAUSE_VECTOR;
> +      id = "length";
> +      break;
> +    case PRAGMA_OACC_CLAUSE_WORKER:
> +      kind = OMP_CLAUSE_WORKER;
> +      break;
> +    }

Then you can replace this switch with just if (kind == OMP_CLAUSE_VECTOR)
id = "length";

        Jakub

Reply via email to