]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/c/c-typeck.c
Added _Cilk_spawn and _Cilk_sync (2 cilk keywords) for C.
[thirdparty/gcc.git] / gcc / c / c-typeck.c
index 1d83137cd3f65af6e9e1280666c9dc78cf142bb1..1034cee1fcce50d4cae82e812a466ed91eab3452 100644 (file)
@@ -4387,6 +4387,14 @@ build_compound_expr (location_t loc, tree expr1, tree expr2)
   tree eptype = NULL_TREE;
   tree ret;
 
+  if (flag_enable_cilkplus
+      && (TREE_CODE (expr1) == CILK_SPAWN_STMT
+         || TREE_CODE (expr2) == CILK_SPAWN_STMT))
+    {
+      error_at (loc,
+               "spawned function call cannot be part of a comma expression");
+      return error_mark_node;
+    }
   expr1_int_operands = EXPR_INT_CONST_OPERANDS (expr1);
   if (expr1_int_operands)
     expr1 = remove_c_maybe_const_expr (expr1);
@@ -8694,6 +8702,12 @@ c_finish_return (location_t loc, tree retval, tree origtype)
          return error_mark_node;
        }
     }
+  if (flag_enable_cilkplus && retval && TREE_CODE (retval) == CILK_SPAWN_STMT)
+    {
+      error_at (loc, "use of %<_Cilk_spawn%> in a return statement is not "
+               "allowed");
+      return error_mark_node;
+    }
   if (retval)
     {
       tree semantic_type = NULL_TREE;