Merge with upstream DMD 74ac873be1862090b7ec0e4a876fd1b758520359. This fixes various MinGW host build errors in filename.c.
Additionally provide _mkdir in d-system.h as we do not include the windows 'direct.h' header. gcc/d/ChangeLog: 2019-03-23 Johannes Pfau <johannesp...@gmail.com> PR d/87799 * d-system.h (_mkdir): Define to mkdir for MinGW hosts. * dmd/root/filename.c: Merge related dmd-cxx fixes. --- gcc/d/d-system.h | 6 ++++++ gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/root/filename.c | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gcc/d/d-system.h b/gcc/d/d-system.h index efece15f3bc..6c18b69d4df 100644 --- a/gcc/d/d-system.h +++ b/gcc/d/d-system.h @@ -55,4 +55,10 @@ #undef tolower #define tolower(c) TOLOWER(c) +/* We do not include direct.h as it conflicts with system.h. */ +#ifdef _WIN32 +#undef _mkdir +#define _mkdir(p) mkdir(p, 0) +#endif + #endif /* GCC_D_SYSTEM_H */ diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index a8757427849..3017f0d34af 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -fe8b2c2c2a4ede475f15a082f26460275cdef42e +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/root/filename.c b/gcc/d/dmd/root/filename.c index 0e7b79db806..6144d810fb5 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) { -- 2.19.2