Conversation
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#8317" |
0d2ee2b to
ae61b0e
Compare
You could do the rename in on commit and the actual changes in a second commit. The it's possible to diff the individual commits, but perhaps not directly on GitHub. Also, is there a reason to call it |
| while (list_freelist) | ||
| { | ||
| list_t list = list_next(list_freelist); | ||
| list_freelist = list; |
There was a problem hiding this comment.
The C implementation had a call to list_delete here.
There was a problem hiding this comment.
Yes, it does seem to be missing!
src/dmd/backend/dlist.d
Outdated
| } | ||
|
|
||
|
|
||
| list_t list_alloc(); |
There was a problem hiding this comment.
Leftover from the conversion. Removed.
| * Returns: | ||
| * pointer to that list entry. | ||
| */ | ||
|
|
There was a problem hiding this comment.
I'm not sure why you always have a newline between the DDoc and the code. I recommend removing it, but it's not a problem.
There was a problem hiding this comment.
The newline is the style commonly used. Others have started using the no newline approach. Besides, I try to minimize diffs on initial conversions.
| if (list) | ||
| { | ||
| list.next = *plist; | ||
| list.ptr = ptr; |
There was a problem hiding this comment.
C implementation used the list_next and list_ptr wrappers. It seems to be the same functionality, but throughout this file you're sometimes using the wrapper and sometimes not. It makes it a little hard to review and the code is inconsistent.
There was a problem hiding this comment.
list_next and list_ptr don't work as lvalues in D.
|
|
||
|
|
||
| list_t list_new() { return cast(list_t)malloc(LIST.sizeof); } | ||
| void list_delete(list_t list) { free(list); } |
There was a problem hiding this comment.
These two functions are never used in the new dlist.d and haven't been used outside of list.c
wilzbach
left a comment
There was a problem hiding this comment.
Let's move finally forward with this!
I'm just unsure about the commented va_end call.
| </ClCompile> | ||
| <ClCompile Include="..\dmd\tk\vec.c"> | ||
| <Filter>dmd\tk</Filter> | ||
| </ClCompile> |
There was a problem hiding this comment.
It might make sense to move the vec.h header file to the backend, s.t. D code and header files are "in sync".
| pe = &list.next; | ||
| } | ||
| } | ||
| //va_end(ap); |
There was a problem hiding this comment.
What's the reason for not calling va_end here?
(in C it's called)
There was a problem hiding this comment.
There was some problem with it being @nogc and nothrow. core.stdc.stdarg apparently needs some additional work.
|
|
||
| alias void function(void*) @nogc nothrow list_free_fp; | ||
|
|
||
| enum FPNULL = cast(list_free_fp)null; |
There was a problem hiding this comment.
You can avoid the cast with enum list_free_fp FPNULL = null. But defining a new symbol here doesn't really buy a lot in comparison to just using null.
There was a problem hiding this comment.
FPNULL dates from the olden days when function pointers were different from regular pointers due to the wacky DOS memory models. It doesn't make sense any more, as you point out, but changing it here violates the #1 rule of translation.
| { | ||
| list = list_freelist; | ||
| list_freelist = list_next(list); | ||
| //mem_setnewfileline(list,file,line); |
There was a problem hiding this comment.
Keeping this as a comment doesn't really help as all the (conditional) parameter declarations have gone.
| struct LIST | ||
| { | ||
| /* Do not access items in this struct directly, use the */ | ||
| /* functions designed for that purpose. */ |
There was a problem hiding this comment.
Gawd will smite me if I violate the #1 rule of translation.
There was a problem hiding this comment.
Note that if I make it private now, then I have to add to this PR all the other files that are modified to make that work. Of course, that will inevitably cause more problems. Such changes need to be separate PRs.
|
Fellas, these are good suggestions but please keep in mind the #1 rule of translating code - do not attempt to refactor, fix, enhance, improve, rename, reorganize, etc. the code. Do as little as possible to get it to work. I have learned this bitter lesson over and over and over. |
JinShil
left a comment
There was a problem hiding this comment.
do not attempt to refactor, fix, enhance, improve, rename, reorganize, etc. the code
Yeah, let's get this done.
Git diff doesn't seem to render diffs when files get renamed. :-(