win32: treat long double as double

tcc-xref
grischka 2009-07-18 22:07:17 +02:00
parent 97738d1ae9
commit 9fda4f4248
2 changed files with 16 additions and 0 deletions

View File

@ -2527,7 +2527,9 @@ static int parse_btype(CType *type, AttributeDef *ad)
case TOK_LONG:
next();
if ((t & VT_BTYPE) == VT_DOUBLE) {
#ifndef TCC_TARGET_PE
t = (t & ~VT_BTYPE) | VT_LDOUBLE;
#endif
} else if ((t & VT_BTYPE) == VT_LONG) {
t = (t & ~VT_BTYPE) | VT_LLONG;
} else {
@ -2544,7 +2546,11 @@ static int parse_btype(CType *type, AttributeDef *ad)
case TOK_DOUBLE:
next();
if ((t & VT_BTYPE) == VT_LONG) {
#ifdef TCC_TARGET_PE
t = (t & ~VT_BTYPE) | VT_DOUBLE;
#else
t = (t & ~VT_BTYPE) | VT_LDOUBLE;
#endif
} else {
u = VT_DOUBLE;
goto basic_type1;

10
tccpp.c
View File

@ -1743,9 +1743,14 @@ void parse_number(const char *p)
tokc.f = (float)d;
} else if (t == 'L') {
ch = *p++;
#ifdef TCC_TARGET_PE
tok = TOK_CDOUBLE;
tokc.d = d;
#else
tok = TOK_CLDOUBLE;
/* XXX: not large enough */
tokc.ld = (long double)d;
#endif
} else {
tok = TOK_CDOUBLE;
tokc.d = d;
@ -1794,8 +1799,13 @@ void parse_number(const char *p)
tokc.f = strtof(token_buf, NULL);
} else if (t == 'L') {
ch = *p++;
#ifdef TCC_TARGET_PE
tok = TOK_CDOUBLE;
tokc.d = strtod(token_buf, NULL);
#else
tok = TOK_CLDOUBLE;
tokc.ld = strtold(token_buf, NULL);
#endif
} else {
tok = TOK_CDOUBLE;
tokc.d = strtod(token_buf, NULL);