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

Can't build 'make' with dmd 2.080.0 #5

Open
biocyberman opened this issue Jun 12, 2018 · 4 comments
Open

Can't build 'make' with dmd 2.080.0 #5

biocyberman opened this issue Jun 12, 2018 · 4 comments

Comments

@biocyberman
Copy link

git clone https://github.com/DigitalMars/Compiler.git 
cd Compiler/dm/src/make
dmd --version 
DMD64 D Compiler v2.080.0
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright
dmd dmake dman -O -release -inline 
dmake.d(916): Error: undefined identifier TRUE, did you mean true?
dmake.d(1088): Error: cannot implicitly convert expression strlen(text) of type ulong to uint
dmake.d(1094): Error: cannot implicitly convert expression strlen(buf) of type ulong to uint
dmake.d(1231): Error: function dmake.mem_calloc(uint size) is not callable using argument types (ulong)
dmake.d(1231):        cannot pass argument strlen(name) + strlen(ext) + 1LU + 1LU of type ulong to parameter uint size
dmake.d(1776): Error: function dmake.mem_calloc(uint size) is not callable using argument types (ulong)
dmake.d(1776):        cannot pass argument strlen(s) + 1LU of type ulong to parameter uint size
@WalterBright
Copy link
Contributor

It hasn't been ported to 64 bits or systems other than Win32 yet.

@biocyberman
Copy link
Author

Oh I see. Thanks

@WalterBright
Copy link
Contributor

It's still a bug, just not in the Win32 version. I should fix it.

@WalterBright WalterBright reopened this Jun 13, 2018
@biocyberman
Copy link
Author

biocyberman commented Jun 14, 2018

Yeah I actually fixed all the errors before opening this issue. But it did not work anyway so I report the 'original' problem.

FYI, this is what I changed on my local repo, keeping the spirit of "recreate first, optimize later":

diff --git a/dm/src/make/dmake.d b/dm/src/make/dmake.d
index fb858e7..6f438c5 100644
--- a/dm/src/make/dmake.d
+++ b/dm/src/make/dmake.d
@@ -913,7 +913,7 @@ int readline(FILE *f)
         do
         {
                 L0:
-            while (TRUE)
+            while (true)
             {
                         if (i >= bufmax)
                         {   bufmax += 100;
@@ -1085,13 +1085,13 @@ char *expandline(char *buf)
             buf[p] = 0;
             text = searchformacro(buf + b);
             buf[p] = c;
-            textlen = strlen(text);
+            textlen = cast(uint)strlen(text);
             /* If replacement text exactly matches macro call, skip expansion */
             if (textlen == t - i && strncmp(text,buf + i,t - i) == 0)
                 i = t;
             else
             {
-                buflen = strlen(buf);
+              buflen = cast(uint)strlen(buf);
                 buf = cast(char*)mem_realloc(buf,buflen + textlen + 1);
                 memmove(buf + i + textlen,buf + t,buflen + 1 - t);
                 memmove(buf + i,text,textlen);
@@ -1228,7 +1228,7 @@ int ispchar(char c)
 char *filespecforceext(char* name, char* ext)
 {       char* newname,p;
 
-        newname = cast(char*)mem_calloc(strlen(name) + strlen(ext) + 1 + 1);
+  newname = cast(char*)mem_calloc(cast(uint)(strlen(name) + strlen(ext) + 1 + 1));
         strcpy(newname,name);
         p = filespecdotext(newname);
         *p++ = '.';
@@ -1773,7 +1773,7 @@ void *mem_realloc(void *oldbuf,uint newbufsize)
 
 char *mem_strdup(const char *s)
 {
-    return strcpy(cast(char*)mem_calloc(strlen(s) + 1),s);
+  return strcpy(cast(char*)mem_calloc(cast(uint)(strlen(s) + 1)),s);
 }
 
 }

And compile:

dmd dmake dman -O -release -betterC -I.
dmake.o: In function `main':
dman.d:(.text.main[main]+0xc1): undefined reference to `RESPONSE_EXPAND'
dmake.o: In function `builtin_del':
dman.d:(.text.builtin_del[builtin_del]+0x74): undefined reference to `findfirst'
dman.d:(.text.builtin_del[builtin_del]+0x8a): undefined reference to `findnext'
dmake.o: In function `executerule':
dman.d:(.text.executerule[executerule]+0xfb): undefined reference to `spawnlp'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

findfirst and findnext have not been implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants