summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfche <fche>2005-06-05 16:41:48 +0000
committerfche <fche>2005-06-05 16:41:48 +0000
commit22f4623195facb4cbc1b50c45c0bd689f6958a9d (patch)
tree1ee468efab2a3f1f1a18cfb02c0bd5c31e541c57
parentf3c26ea55e2f2c1d222312bf75035359c439ed21 (diff)
downloadsystemtap-steved-22f4623195facb4cbc1b50c45c0bd689f6958a9d.tar.gz
systemtap-steved-22f4623195facb4cbc1b50c45c0bd689f6958a9d.tar.xz
systemtap-steved-22f4623195facb4cbc1b50c45c0bd689f6958a9d.zip
next/return symmetry improvement
-rw-r--r--elaborate.cxx7
-rwxr-xr-xtestsuite/transko/two.stp1
-rw-r--r--translate.cxx4
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;";
}