+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
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);
}
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;