From 8846477c222cdae649b02117cc96999b0be6ad40 Mon Sep 17 00:00:00 2001 From: fche Date: Sat, 4 Jun 2005 02:35:18 +0000 Subject: 2005-06-03 Frank Ch. Eigler * elaborate.cxx (find_*): Remove arity checks from here ... * staptree.cxx (set_arity): Put arity match assertion here. * testsuite/semko/{six,nine}.stp: Confirm logic. * testsuite/transko/one.stp: First translation-time ko test. --- ChangeLog | 7 +++++++ elaborate.cxx | 52 ++++++++++++++++++++++------------------------- staptree.cxx | 15 ++++++++++---- testsuite/semko/nine.stp | 2 ++ testsuite/semko/six.stp | 1 + testsuite/transko/one.stp | 6 ++++++ 6 files changed, 51 insertions(+), 32 deletions(-) create mode 100755 testsuite/transko/one.stp diff --git a/ChangeLog b/ChangeLog index a5063923..5b495119 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-03 Frank Ch. Eigler + + * elaborate.cxx (find_*): Remove arity checks from here ... + * staptree.cxx (set_arity): Put arity match assertion here. + * testsuite/semko/{six,nine}.stp: Confirm logic. + * testsuite/transko/one.stp: First translation-time ko test. + 2005-06-03 Frank Ch. Eigler * TODO: Removed entries already represented in bugzilla. diff --git a/elaborate.cxx b/elaborate.cxx index e733132f..c6596da6 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -292,43 +292,48 @@ symresolution_info::find_scalar (const string& name) current_probe->locals); for (unsigned i=0; iname == name) - // NB: no need to check arity here: locals always scalar - return locals[i]; + { + // NB: no need to check arity here: formal args always scalar + locals[i]->set_arity (0); + return locals[i]; + } // search function formal parameters (if any) if (current_function) for (unsigned i=0; iformal_args.size(); i++) if (current_function->formal_args[i]->name == name) - // NB: no need to check arity here: formal args always scalar - return current_function->formal_args[i]; + { + // NB: no need to check arity here: formal args always scalar + current_function->formal_args[i]->set_arity (0); + return current_function->formal_args[i]; + } // search globals for (unsigned i=0; iname == name) - if (session.globals[i]->arity <= 0) - { - session.globals[i]->set_arity (0); - return session.globals[i]; - } + { + session.globals[i]->set_arity (0); + return session.globals[i]; + } // search library globals for (unsigned i=0; iglobals.size(); j++) - if (f->globals[j]->name == name && - f->globals[j]->index_types.size() == 0) + if (f->globals[j]->name == name) { // put library into the queue if not already there if (0) // (session.verbose_resolution) cerr << " scalar " << name << " " << "is defined from " << f->name << endl; - + if (find (session.files.begin(), session.files.end(), f) == session.files.end()) session.files.push_back (f); // else .. print different message? + f->globals[j]->set_arity (0); return f->globals[j]; } } @@ -353,7 +358,6 @@ symresolution_info::find_scalar (const string& name) } return 0; - // XXX: add checking for conflicting array or function } @@ -363,13 +367,10 @@ symresolution_info::find_array (const string& name, unsigned arity) // search processed globals for (unsigned i=0; iname == name) - if ((arity > 0 && (session.globals[i]->arity == (int) arity)) || - session.globals[i]->arity < 0) - { - if (arity > 0) - session.globals[i]->set_arity (arity); - return session.globals[i]; - } + { + session.globals[i]->set_arity (arity); + return session.globals[i]; + } // search library globals for (unsigned i=0; iglobals.size(); j++) if (f->globals[j]->name == name) - if ((arity > 0 && (f->globals[j]->arity == (int) arity)) || - f->globals[j]->arity < 0) { - if (arity > 0) - f->globals[j]->set_arity (arity); + f->globals[j]->set_arity (arity); // put library into the queue if not already there if (0) // (session.verbose_resolution) cerr << " array " << name << " " << "is defined from " << f->name << endl; - + if (find (session.files.begin(), session.files.end(), f) == session.files.end()) session.files.push_back (f); // else .. print different message? - + return f->globals[j]; } } return 0; - // XXX: add checking for conflicting scalar or function } @@ -436,7 +433,6 @@ symresolution_info::find_function (const string& name, unsigned arity) } return 0; - // XXX: add checking for conflicting variables } diff --git a/staptree.cxx b/staptree.cxx index a8651d1d..756fbc1e 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -96,10 +96,17 @@ void vardecl::set_arity (int a) { assert (a >= 0); - arity = a; - index_types.resize (arity); - for (int i=0; i= 0) + throw semantic_error ("inconsistent arity", tok); + + if (arity != a) + { + arity = a; + index_types.resize (arity); + for (int i=0; i