Fix Bullet support (Broken float division in default args in interrogate)

This commit is contained in:
rdb 2015-04-09 13:08:17 +02:00
parent 8a9e30afa8
commit 8e76328b3b
2 changed files with 14 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include "cppFunctionGroup.h"
#include "cppFunctionType.h"
#include "cppBison.h"
#include "pdtoa.h"
#include <assert.h>
@ -1079,7 +1080,13 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
break;
case T_real:
out << _u._real;
{
// We use our own dtoa implementation here because it guarantees
// to never format the number as an integer.
char buffer[32];
pdtoa(_u._real, buffer);
out << buffer;
}
break;
case T_string:
@ -1155,14 +1162,15 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const {
break;
case T_construct:
out << "(" << _u._typecast._to->get_typedef_name(scope)
<< "(";
_u._typecast._to->output(out, indent_level, scope, false);
out << "(";
_u._typecast._op1->output(out, indent_level, scope, false);
out << "))";
out << ")";
break;
case T_default_construct:
out << "(" << _u._typecast._to->get_typedef_name(scope) << "())";
_u._typecast._to->output(out, indent_level, scope, false);
out << "()";
break;
case T_new:

View File

@ -558,7 +558,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete,
out << " = 0";
}
if (_initializer != NULL) {
out << " = (" << *_initializer << ")";
out << " = " << *_initializer;
}
}