[PATCH 2/5] Error out for Cilk_spawn or array expression in forbidden places
Joseph S. Myers
joseph@codesourcery.com
Thu Oct 2 15:07:00 GMT 2014
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
More information about the Gcc-patches
mailing list