Commit 70d2d777 by Iain Buclaw

d/dmd: Merge upstream dmd 74ac873be

Introduces a fix for a segfault when building without object.d being
present, as well as MinGW host build errors in dmd/root/filename.c.

Updates a couple of non-portable tests, removing one and fixing the
other.

From-SVN: r269897
parent 4dd11305
8d4c876c658608e8f6e653803c534a9e15618f57
74ac873be1862090b7ec0e4a876fd1b758520359
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
......@@ -302,7 +302,7 @@ bool Module::read(Loc loc)
{
::error(loc, "cannot find source code for runtime library file 'object.d'");
errorSupplemental(loc, "dmd might not be correctly installed. Run 'dmd -man' for installation instructions.");
const char *dmdConfFile = FileName::canonicalName(global.inifilename);
const char *dmdConfFile = global.inifilename ? FileName::canonicalName(global.inifilename) : NULL;
errorSupplemental(loc, "config file: %s", dmdConfFile ? dmdConfFile : "not found");
}
else
......
......@@ -262,6 +262,7 @@ const char *FileName::name(const char *str)
if (e == str + 1 || e == str + len - 1)
return e + 1;
#endif
/* falls through */
default:
if (e == str)
break;
......@@ -542,7 +543,7 @@ int FileName::exists(const char *name)
int result;
dw = GetFileAttributesA(name);
if (dw == -1L)
if (dw == INVALID_FILE_ATTRIBUTES)
result = 0;
else if (dw & FILE_ATTRIBUTE_DIRECTORY)
result = 2;
......@@ -568,7 +569,7 @@ bool FileName::ensurePathExists(const char *path)
size_t len = strlen(path);
if ((len > 2 && p[-1] == ':' && strcmp(path + 2, p) == 0) ||
len == strlen(p))
{ mem.xfree(const_cast<void *>(p));
{ mem.xfree(const_cast<char *>(p));
return 0;
}
#endif
......@@ -621,7 +622,7 @@ const char *FileName::canonicalName(const char *name)
DWORD result = GetFullPathNameA(name, 0, NULL, NULL);
if (result)
{
char *buf = (char *)malloc(result);
char *buf = (char *)mem.xmalloc(result);
result = GetFullPathNameA(name, result, buf, NULL);
if (result == 0)
{
......
version(GNU)
{
static assert(0);
}
version(Win64)
{
static assert(0);
}
else version(X86_64)
{
void error(...){}
}
else
{
static assert(0);
}
......@@ -224,46 +224,26 @@ void test6()
assert(&t.Bottom < &t.foo2);
assert(TRECT6.foo1.offsetof == 0);
version (Win32)
{
assert(TRECT6.Left.offsetof == 8);
assert(TRECT6.Top.offsetof == 12);
assert(TRECT6.Right.offsetof == 16);
assert(TRECT6.Bottom.offsetof == 20);
assert(TRECT6.TopLeft.offsetof == 8);
assert(TRECT6.BottomRight.offsetof == 16);
assert(TRECT6.foo2.offsetof == 24);
}
else version (X86_64)
{
assert(TRECT6.Left.offsetof == 8);
assert(TRECT6.Top.offsetof == 12);
assert(TRECT6.Right.offsetof == 16);
assert(TRECT6.Bottom.offsetof == 20);
assert(TRECT6.TopLeft.offsetof == 8);
assert(TRECT6.BottomRight.offsetof == 16);
assert(TRECT6.foo2.offsetof == 24);
}
else version(ARM)
{
assert(TRECT6.Left.offsetof == 8);
assert(TRECT6.Top.offsetof == 12);
assert(TRECT6.Right.offsetof == 16);
assert(TRECT6.Bottom.offsetof == 20);
assert(TRECT6.TopLeft.offsetof == 8);
assert(TRECT6.BottomRight.offsetof == 16);
assert(TRECT6.foo2.offsetof == 24);
}
else
{
assert(TRECT6.Left.offsetof == 4);
assert(TRECT6.Top.offsetof == 8);
assert(TRECT6.Right.offsetof == 12);
assert(TRECT6.Bottom.offsetof == 16);
assert(TRECT6.TopLeft.offsetof == 4);
assert(TRECT6.BottomRight.offsetof == 12);
assert(TRECT6.foo2.offsetof == 20);
}
static if (long.alignof == 8)
{
assert(TRECT6.Left.offsetof == 8);
assert(TRECT6.Top.offsetof == 12);
assert(TRECT6.Right.offsetof == 16);
assert(TRECT6.Bottom.offsetof == 20);
assert(TRECT6.TopLeft.offsetof == 8);
assert(TRECT6.BottomRight.offsetof == 16);
assert(TRECT6.foo2.offsetof == 24);
}
else
{
assert(TRECT6.Left.offsetof == 4);
assert(TRECT6.Top.offsetof == 8);
assert(TRECT6.Right.offsetof == 12);
assert(TRECT6.Bottom.offsetof == 16);
assert(TRECT6.TopLeft.offsetof == 4);
assert(TRECT6.BottomRight.offsetof == 12);
assert(TRECT6.foo2.offsetof == 20);
}
}
/* ================================ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment