diff options
author | dsmith <dsmith> | 2007-08-30 20:23:50 +0000 |
---|---|---|
committer | dsmith <dsmith> | 2007-08-30 20:23:50 +0000 |
commit | e1407ce08eeafc0295200b610c995e1142d5ffe5 (patch) | |
tree | 2fbaee22130cc32e498158cfca55177da92c03ab | |
parent | 8d2ea625fc11466f4477afc1e1b90f8f1b3260cc (diff) | |
download | systemtap-steved-e1407ce08eeafc0295200b610c995e1142d5ffe5.tar.gz systemtap-steved-e1407ce08eeafc0295200b610c995e1142d5ffe5.tar.xz systemtap-steved-e1407ce08eeafc0295200b610c995e1142d5ffe5.zip |
2007-08-30 David Smith <dsmith@redhat.com>
PR 4983
* translate.cxx (c_tmpcounter::visit_print_format): Don't declare
temporaries for number and string constants.
(c_unparser::visit_print_format): Use numeric and string constants
directly instead of copying them into temporaries.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | translate.cxx | 16 |
2 files changed, 22 insertions, 2 deletions
@@ -1,3 +1,11 @@ +2007-08-30 David Smith <dsmith@redhat.com> + + PR 4983 + * translate.cxx (c_tmpcounter::visit_print_format): Don't declare + temporaries for number and string constants. + (c_unparser::visit_print_format): Use numeric and string constants + directly instead of copying them into temporaries. + 2007-08-27 Frank Ch. Eigler <fche@redhat.com> PR 4817 diff --git a/translate.cxx b/translate.cxx index 4891c617..d621cf26 100644 --- a/translate.cxx +++ b/translate.cxx @@ -3938,7 +3938,9 @@ c_tmpcounter::visit_print_format (print_format* e) e->args[i]->tok); } - t.declare (*parent); + if (e->args[i]->tok->type != tok_number + && e->args[i]->tok->type != tok_string) + t.declare (*parent); e->args[i]->visit (this); } @@ -4004,7 +4006,17 @@ c_unparser::visit_print_format (print_format* e) o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->args[i]->tok) << ";"; - c_assign (t.value(), e->args[i], "print format actual argument evaluation"); + + // If we've got a numeric or string constant, instead of + // assigning the numeric or string constant to a temporary, + // then passing the temporary to _stp_printf/_stp_snprintf, + // let's just override the temporary with the constant. + if (e->args[i]->tok->type == tok_number + || e->args[i]->tok->type == tok_string) + tmp[i].override(c_expression(e->args[i])); + else + c_assign (t.value(), e->args[i], + "print format actual argument evaluation"); } std::vector<print_format::format_component> components; |