Warn when the value of "spawn" is unused, as it's useless

This commit is contained in:
Patrick Walton 2010-08-20 17:14:47 -07:00
parent c0e173e19a
commit ed92925083
1 changed files with 5 additions and 1 deletions

View File

@ -508,7 +508,11 @@ and parse_stmts (ps:pstate) : Ast.stmt array =
let stmts = expand_tags_to_stmts ps item in
spans ps stmts apos (Ast.STMT_decl decl)
| _ ->
| token ->
if token = SPAWN then
prerr_endline ("warning: \"spawn\" with unused result spawns a " ^
"task that immediately dies");
let (lstmts, lval) = ctxt "stmt: lval" parse_lval ps in
let stmts =
match peek ps with