Preprocessor: avoid name clashes with model local variables

time-shift
Sébastien Villemot 2011-02-21 16:32:21 +01:00
parent 056dfeb169
commit e76dfadc78
2 changed files with 6 additions and 2 deletions

View File

@ -596,7 +596,9 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
output << ")";
}
else
output << datatree.symbol_table.getName(symb_id);
/* We append underscores to avoid name clashes with "g1" or "oo_" (see
also ModelTree::writeModelLocalVariables) */
output << datatree.symbol_table.getName(symb_id) << "__";
break;
case eModFileLocalVariable:

View File

@ -1171,7 +1171,9 @@ ModelTree::writeModelLocalVariables(ostream &output, ExprNodeOutputType output_t
if (IS_C(output_type))
output << "double ";
output << symbol_table.getName(id) << " = ";
/* We append underscores to avoid name clashes with "g1" or "oo_" (see
also VariableNode::writeOutput) */
output << symbol_table.getName(id) << "__ = ";
// Use an empty set for the temporary terms
value->writeOutput(output, output_type);
output << ";" << endl;