This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] Error out for Cilk_spawn or array expression in forbidden places


On Wed, 1 Oct 2014, Andi Kleen wrote:

> +/* Check that no array notation or spawn statement is in EXPR.
> +   If not true gemerate an error at LOC for WHAT.  */
> +
> +bool
> +check_no_cilk (tree expr, const char *what, location_t loc)
> +{
> +  if (!flag_cilkplus)
> +    return false;
> +  if (contains_array_notation_expr (expr))
> +    {
> +      loc = get_error_location (expr, loc);
> +      error_at (loc, "Cilk array notation cannot be used %s", what);
> +      return true;
> +    }
> +  if (walk_tree (&expr, contains_cilk_spawn_stmt_walker, NULL, NULL))
> +    {
> +      loc = get_error_location (expr, loc);
> +      error_at (loc, "%<_Cilk_spawn%> statement cannot be used %s", what);

You need to pass two complete error messages to this function for i18n 
purposes, rather than building up messages from sentence fragments.  If 
you call them e.g. array_gmsgid and spawn_gmsgid they should both get 
extracted by exgettext for translation.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]