1 /* This file is part of the Intel(R) Cilk(TM) Plus support
2 This file contains routines to handle Cilk Plus specific
3 routines for the C++ Compiler.
4 Copyright (C) 2013 Free Software Foundation, Inc.
5 Contributed by Aldy Hernandez <aldyh@redhat.com>.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
14 GCC is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
27 #include "diagnostic-core.h"
30 /* Callback for cp_walk_tree to validate the body of a pragma simd loop
33 This function is passed in as a function pointer to walk_tree. *TP is
34 the current tree pointer, *WALK_SUBTREES is set to 0 by this function if
35 recursing into TP's subtrees is unnecessary. *DATA is a bool variable that
36 is set to false if an error has occured. */
39 cpp_validate_cilk_plus_loop_aux (tree
*tp
, int *walk_subtrees
, void *data
)
41 bool *valid
= (bool *) data
;
42 location_t loc
= EXPR_HAS_LOCATION (*tp
) ? EXPR_LOCATION (*tp
) :
48 if (TREE_CODE (*tp
) == THROW_EXPR
)
50 error_at (loc
, "throw expressions are not allowed inside loops "
51 "marked with pragma simd");
55 else if (TREE_CODE (*tp
) == TRY_BLOCK
)
57 error_at (loc
, "try statements are not allowed inside loops marked "
66 /* Walks through all the subtrees of BODY using walk_tree to make sure
67 invalid statements/expressions are not found inside BODY. Returns
68 false if any invalid statements are found. */
71 cpp_validate_cilk_plus_loop (tree body
)
74 cp_walk_tree (&body
, cpp_validate_cilk_plus_loop_aux
,
75 (void *) &valid
, NULL
);