diff options
-rw-r--r-- | elaborate.cxx | 7 | ||||
-rwxr-xr-x | testsuite/transko/two.stp | 1 | ||||
-rw-r--r-- | translate.cxx | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/elaborate.cxx b/elaborate.cxx index f3edd81b..309b4115 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1047,12 +1047,9 @@ typeresolution_info::visit_return_statement (return_statement* e) // This is like symbol, where the referent is // the return value of the function. - // XXX: need control flow semantic checking; until then: + // translation pass will print error if (current_function == 0) - { - unresolved (e->tok); - return; - } + return; exp_type& e_type = current_function->type; t = current_function->type; diff --git a/testsuite/transko/two.stp b/testsuite/transko/two.stp index 69f78b5c..77e1f6d0 100755 --- a/testsuite/transko/two.stp +++ b/testsuite/transko/two.stp @@ -8,4 +8,5 @@ probe foo { break for (a=0; a<10; a=a+1) for (b=0; b<10; b=b+1) ; continue + return 0 } diff --git a/translate.cxx b/translate.cxx index df20389f..1c9724d9 100644 --- a/translate.cxx +++ b/translate.cxx @@ -698,7 +698,7 @@ void c_unparser::visit_return_statement (return_statement* s) { if (current_function == 0) - throw semantic_error ("cannot return from non-function", s->tok); + throw semantic_error ("cannot 'return' from probe", s->tok); if (s->value->type != current_function->type) throw semantic_error ("return type mismatch", current_function->tok, @@ -713,7 +713,7 @@ void c_unparser::visit_next_statement (next_statement* s) { if (current_probe == 0) - throw semantic_error ("cannot 'next' from non-probe", s->tok); + throw semantic_error ("cannot 'next' from function", s->tok); o->newline() << "goto out;"; } |