Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple of issues wrt. Visual Studio 2015 #3304

Merged
merged 2 commits into from
May 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions std/conv.d
Original file line number Diff line number Diff line change
@@ -2973,12 +2973,19 @@ unittest
ld = parse!real(s2);
assert(s2.empty);
x = *cast(longdouble *)&ld;
version (CRuntime_Microsoft)
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
else version (Android)
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod

static if(real.mant_dig == 64)
{
version (CRuntime_Microsoft)
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
else version (Android)
ld1 = 0x1.FFFFFFFFFFFFFFFEp-16382L; // strtold currently mapped to strtod
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These literals are for 80-bit x87 reals, that's why I guarded this block with an appropriate static if. It's not related to VS 2015.

else
ld1 = strtold(s.ptr, null);
}
else
ld1 = strtold(s.ptr, null);

x1 = *cast(longdouble *)&ld1;
assert(x1 == x && ld1 == ld);

9 changes: 6 additions & 3 deletions std/format.d
Original file line number Diff line number Diff line change
@@ -3728,7 +3728,8 @@ unittest
}
else version (CRuntime_Microsoft)
{
assert(stream.data == "1.67 -0X1.47AE14P+0 nan",
assert(stream.data == "1.67 -0X1.47AE14P+0 nan"
|| stream.data == "1.67 -0X1.47AE147AE147BP+0 nan", // MSVCRT 14+ (VS 2015)
stream.data);
}
else version (Android)
@@ -3764,7 +3765,8 @@ unittest
formattedWrite(stream, "%a %A", 1.32, 6.78f);
//formattedWrite(stream, "%x %X", 1.32);
version (CRuntime_Microsoft)
assert(stream.data == "0x1.51eb85p+0 0X1.B1EB86P+2");
assert(stream.data == "0x1.51eb85p+0 0X1.B1EB86P+2"
|| stream.data == "0x1.51eb851eb851fp+0 0X1.B1EB860000000P+2"); // MSVCRT 14+ (VS 2015)
else version (Android)
{
// bionic doesn't support hex formatting of floating point numbers,
@@ -6246,7 +6248,8 @@ unittest
version (MinGW)
assert(s == "1.67 -0XA.3D70A3D70A3D8P-3 nan", s);
else version (CRuntime_Microsoft)
assert(s == "1.67 -0X1.47AE14P+0 nan", s);
assert(s == "1.67 -0X1.47AE14P+0 nan"
|| s == "1.67 -0X1.47AE147AE147BP+0 nan", s); // MSVCRT 14+ (VS 2015)
else version (Android)
{
// bionic doesn't support hex formatting of floating point numbers
2 changes: 1 addition & 1 deletion std/outbuffer.d
Original file line number Diff line number Diff line change
@@ -269,7 +269,7 @@ class OutBuffer
{
version(Windows)
{
count = _vsnprintf(p,psize,f,args);
count = vsnprintf(p,psize,f,args);
if (count != -1)
break;
psize *= 2;
2 changes: 1 addition & 1 deletion std/stream.d
Original file line number Diff line number Diff line change
@@ -1181,7 +1181,7 @@ class Stream : InputStream, OutputStream {
size_t count;
while (true) {
version (Windows) {
count = _vsnprintf(p, psize, f, args);
count = vsnprintf(p, psize, f, args);
if (count != -1)
break;
psize *= 2;