aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gcc.gnu.org>2019-03-24 16:20:43 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-03-24 16:20:43 +0000
commit70d2d77700744378ed1a4c6888c510781cd717ac (patch)
tree085a91cca83e20849cecb84036e72ee2e159832f
parent4dd1130557b74008d0404d3af7b384fba5edb8a8 (diff)
downloadgcc-70d2d77700744378ed1a4c6888c510781cd717ac.zip
gcc-70d2d77700744378ed1a4c6888c510781cd717ac.tar.gz
gcc-70d2d77700744378ed1a4c6888c510781cd717ac.tar.bz2
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
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/dmodule.c2
-rw-r--r--gcc/d/dmd/root/filename.c7
-rw-r--r--gcc/testsuite/gdc.test/fail_compilation/fail6451.d18
-rw-r--r--gcc/testsuite/gdc.test/runnable/test4.d60
5 files changed, 26 insertions, 63 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 230fd12..3017f0d 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-8d4c876c658608e8f6e653803c534a9e15618f57
+74ac873be1862090b7ec0e4a876fd1b758520359
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/dmodule.c b/gcc/d/dmd/dmodule.c
index 20dbb69..07e4712 100644
--- a/gcc/d/dmd/dmodule.c
+++ b/gcc/d/dmd/dmodule.c
@@ -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
diff --git a/gcc/d/dmd/root/filename.c b/gcc/d/dmd/root/filename.c
index 0e7b79d..6144d81 100644
--- a/gcc/d/dmd/root/filename.c
+++ b/gcc/d/dmd/root/filename.c
@@ -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)
{
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail6451.d b/gcc/testsuite/gdc.test/fail_compilation/fail6451.d
deleted file mode 100644
index 54c628a..0000000
--- a/gcc/testsuite/gdc.test/fail_compilation/fail6451.d
+++ /dev/null
@@ -1,18 +0,0 @@
-
-version(GNU)
-{
- static assert(0);
-}
-version(Win64)
-{
- static assert(0);
-}
-else version(X86_64)
-{
- void error(...){}
-}
-else
-{
- static assert(0);
-}
-
diff --git a/gcc/testsuite/gdc.test/runnable/test4.d b/gcc/testsuite/gdc.test/runnable/test4.d
index f008da6..b5263e7 100644
--- a/gcc/testsuite/gdc.test/runnable/test4.d
+++ b/gcc/testsuite/gdc.test/runnable/test4.d
@@ -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);
+ }
}
/* ================================ */