From da2df8429b50f29406a3957b2ee4b4cc0ba7f6b2 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 3 May 2010 15:24:46 -0400 Subject: [PATCH] PR11504 part: remove synthetic probe_NNNN name from error messages and most diagnostics * elaborate.cxx (typeresolution_info::visit_target_symbol): Use sole_location as opposed to derived_probe name. (unresolved, invalid, mismatch): Remove the name/etc. prefix, as token context is available. * translate.cxx (emit_lock_decls): Print sole_location here too. --- elaborate.cxx | 26 +++++++------------------- translate.cxx | 2 +- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/elaborate.cxx b/elaborate.cxx index 5c6b0b4c4..9b2f12239 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -4278,7 +4278,7 @@ typeresolution_info::visit_target_symbol (target_symbol* e) } else if (current_probe) { - clog << "probe " << current_probe->name << endl; + clog << "probe " << *current_probe->sole_location() << endl; current_probe->body->print (clog); clog << endl; } @@ -4890,10 +4890,7 @@ typeresolution_info::unresolved (const token* tok) if (assert_resolvability) { stringstream msg; - string nm = (current_function ? current_function->name : - current_probe ? current_probe->name : - "probe condition"); - msg << nm + " with unresolved type"; + msg << "unresolved type "; session.print_error (semantic_error (msg.str(), tok)); } } @@ -4907,13 +4904,10 @@ typeresolution_info::invalid (const token* tok, exp_type pe) if (assert_resolvability) { stringstream msg; - string nm = (current_function ? current_function->name : - current_probe ? current_probe->name : - "probe condition"); if (tok && tok->type == tok_operator) - msg << nm + " uses invalid operator"; + msg << "invalid operator"; else - msg << nm + " with invalid type " << pe; + msg << "invalid type " << pe; session.print_error (semantic_error (msg.str(), tok)); } } @@ -4946,10 +4940,7 @@ typeresolution_info::mismatch (const token* tok, exp_type t1, exp_type t2) } if (!tok_resolved) { - string nm = (current_function ? current_function->name : - current_probe ? current_probe->name : - "probe condition"); - msg << nm + " with type mismatch (" << t1 << " vs. " << t2 << ")"; + msg << "type mismatch (" << t1 << " vs. " << t2 << ")"; } else { @@ -4962,16 +4953,13 @@ typeresolution_info::mismatch (const token* tok, exp_type t1, exp_type t2) break; } } - string nm = (current_function ? current_function->name : - current_probe ? current_probe->name : - "probe condition"); - msg << nm + " with type mismatch (" << t1 << " vs. " << t2 << ")"; + msg << "type mismatch (" << t1 << " vs. " << t2 << ")"; if (!tok_printed) { //error for possible mismatch in the earlier resolved token printed_toks.push_back (resolved_toks[i]); stringstream type_msg; - type_msg << nm + " type first inferred here (" << t2 << ")"; + type_msg << "type was first inferred here (" << t2 << ")"; err1 = new semantic_error (type_msg.str(), resolved_toks[i]); } } diff --git a/translate.cxx b/translate.cxx index 271bf7893..c701aedca 100644 --- a/translate.cxx +++ b/translate.cxx @@ -1765,7 +1765,7 @@ c_unparser::emit_lock_decls(const varuse_collecting_visitor& vut) unsigned numvars = 0; if (session->verbose > 1) - clog << current_probe->name << " locks "; + clog << "probe " << *current_probe->sole_location() << " locks "; o->newline() << "static const struct stp_probe_lock locks[] = {"; o->indent(1); -- 2.43.5