summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-common.h
diff options
context:
space:
mode:
authorak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 05:10:58 +0000
committerak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-11 05:10:58 +0000
commitfdd735a75beb6b4ec00e08a19c5b09cf735956f1 (patch)
tree71d74f86916e6654aeaf8532ad17469a9101b2cd /gcc/c-family/c-common.h
parent325b86d0dea618e99da02d94fe932e386fc28912 (diff)
downloadgcc-fdd735a75beb6b4ec00e08a19c5b09cf735956f1.tar.gz
Error out for Cilk_spawn or array expression in forbidden places
_Cilk_spawn or Cilk array expressions are only allowed on their own, but not in for(), if(), switch, do, while, goto, etc. The C parser didn't always check for that, which lead to ICEs earlier for invalid code. Add a generic helper that checks this and call it where needed in the C frontend. I chose to allow spawn/array for for init and increment expressions. While the Cilk spec could be interpreted to forbid it there too there didn't seem any reason to not allow it. One dark corner is spawn, array in statement expressions not at the end. Right now that's forbidden too. gcc/c-family/: 2014-11-10 Andi Kleen <ak@linux.intel.com> PR c/60804 * c-common.h (check_no_cilk): Declare. * cilk.c (get_error_location): New function. (check_no_cilk): Dito. gcc/c/: 2014-11-10 Andi Kleen <ak@linux.intel.com> PR c/60804 * c-parser.c (c_parser_statement_after_labels): Call check_no_cilk. (c_parser_if_statement): Dito. (c_parser_switch_statement): Dito. (c_parser_while_statement): Dito. (c_parser_do_statement): Dito. (c_parser_for_statement): Dito. * c-typeck.c (c_finish_loop): Dito. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217336 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-common.h')
-rw-r--r--gcc/c-family/c-common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 17b26ce993a..ca6fc8beaf8 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1414,4 +1414,6 @@ extern tree cilk_install_body_pedigree_operations (tree);
extern void cilk_outline (tree, tree *, void *);
extern bool contains_cilk_spawn_stmt (tree);
extern tree cilk_for_number_of_iterations (tree);
+extern bool check_no_cilk (tree, const char *, const char *,
+ location_t loc = UNKNOWN_LOCATION);
#endif /* ! GCC_C_COMMON_H */