+ case CILK_SYNC_STMT: + { + if (!cfun->cilk_frame_decl) +
{ + error_at (input_location, "expected %<_Cilk_spawn%> before
" + "%<_Cilk_sync%>"); + ret = GS_ERROR; +
}
First, surely you have a location you can use, instead of the
generic input_location (perhaps the location for the
CILK_SYNC_STMT??). Also, Can you not check for this in
c_finish_cilk_sync_stmt(), or the corresponding code-- that is, in
the FE somewhere? And hopefully, in a place you can share with the
C++ FE? If it is a real pain, I am willing to let this go, since
it happens only in the Cilk code path, though the general trend
(especially with Andrew's proposed changes) is to do all type
checking as close to the source as possible.
If you look at the codes above (e.g. TRUTH_XOR_EXPR), they all use
input_location. Also, in the beginning of the function there is a
line like this:
if (save_expr != error_mark_node && EXPR_HAS_LOCATION (*expr_p))
input_location = EXPR_LOCATION (*expr_p);
Yes, that is old legacy code. The present move is to steer away from
input_location altogether.
For the 2nd point, there can be a case where (with the help of Gotos)
_Cilk_sync can come before _Cilk_spawn. So, the only way to do this
check is to do it after the entire function is parsed.
Fair enough.
Alright, I'm fine with this current incantation. Thanks for all your
hard work taking care of the things I've pointed out.
It's now up to one of the core maintainers to take it from here.
Aldy