]> sourceware.org Git - systemtap.git/commitdiff
2007-08-30 David Smith <dsmith@redhat.com>
authordsmith <dsmith>
Thu, 30 Aug 2007 20:23:50 +0000 (20:23 +0000)
committerdsmith <dsmith>
Thu, 30 Aug 2007 20:23:50 +0000 (20:23 +0000)
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.

ChangeLog
translate.cxx

index e26ba003694d2295e35ea6173fbfa36ae194f5b6..2732b5cdd93d2373a84312f444e71fa30075474f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 4891c617ce09ddeab49d42c395a5eb04abe80b76..d621cf26b780f80eaacdec1d28f5d8b747e38cd3 100644 (file)
@@ -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;
This page took 0.044522 seconds and 5 git commands to generate.