This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/5] Error out for Cilk_spawn or array expression in forbidden places
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: <gcc-patches at gcc dot gnu dot org>, Andi Kleen <ak at linux dot intel dot com>
- Date: Thu, 2 Oct 2014 15:07:19 +0000
- Subject: Re: [PATCH 2/5] Error out for Cilk_spawn or array expression in forbidden places
- Authentication-results: sourceware.org; auth=none
- References: <1412224018-25368-1-git-send-email-andi at firstfloor dot org> <1412224018-25368-2-git-send-email-andi at firstfloor dot org>
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