Repository navigation
[linux-port] Use WinAdapter.h instead of Win*.h - #237
Conversation
Also MS requested that we separate out the declaration and definition of types where possible.
|
It turned out to be a nice change at the end! :) |
pow2clk
left a comment
There was a problem hiding this comment.
Looks good. I just have some minor organizational questions. The most serious I'd say is the fate of WinFunctions.cpp. I thought it was going into this too.
| @@ -565,9 +790,6 @@ class CHeapPtr : public CHeapPtrBase<T, Allocator> { | |||
| } | |||
| }; | |||
|
|
|||
| // Based on what I see, CComHeapPtr is basically the same as CHeapPtr. | |||
| // It is inherited from it and doesn't seem to add anything... | |||
| // TODO: Verify | |||
|
|
||
| #include "llvm/Support/Compiler.h" | ||
| #include "llvm/Support/WinSAL.h" | ||
| #include <algorithm> // for std::all_of |
There was a problem hiding this comment.
This header and a few others include __cdecl, which is defined in the new WinAdaptor.h. I suppose it's included somewhere above? Or just always included first in the source files?
| #include "llvm/Support/SMLoc.h" | ||
| #include <string> | ||
|
|
||
| #include "llvm/Support/WinSAL.h" |
There was a problem hiding this comment.
This one has _In_range(). I don't know if there are guides over whether required headers should be included in headers or if we rely on them being included in the right order.
There was a problem hiding this comment.
Hm... I think I'll add this back.
There was a problem hiding this comment.
You can if you want. It seemed to build everywhere for me though in spite of that.
| } | ||
| void *CAllocator::Allocate(size_t nBytes) throw() { return malloc(nBytes); } | ||
| void CAllocator::Free(void *p) throw() { free(p); } | ||
|
|
There was a problem hiding this comment.
Shouldn't WinFunctions.cpp be appended here?
There was a problem hiding this comment.
@antiagainst had the opinion that WinFunctions.cpp should remain separate in llvm/Support, while these ones should be under dxc/Support (which is what I have done here).
I don't particularly see an upside to keeping them separate. We can reconsider merging them in a later CL.
There was a problem hiding this comment.
I'm happy either way. Just wanted to verify it wasn't an inadvertent omission.
| DEFINE_CROSS_PLATFORM_UUIDOF(IUnknown) | ||
| DEFINE_CROSS_PLATFORM_UUIDOF(INoMarshal) | ||
| DEFINE_CROSS_PLATFORM_UUIDOF(IStream) | ||
| DEFINE_CROSS_PLATFORM_UUIDOF(ISequentialStream) |
There was a problem hiding this comment.
Why aren't all of them moved to WinAdapter.cpp? Because they aren't windows classes I guess?
There was a problem hiding this comment.
Ideally, we want each interface to have DECLARE_CROSS_PLATFORM_UUIDOF in the header file and the cpp file that implements the interface to have DEFINE_CROSS_PLATFORM_UUIDOF. Until now we didn't have a home for these few interfaces because we didn't have a .cpp file for the adapter classes. So we had just placed them along with the others in dxcapi.cpp. WinAdapter.cpp is a better home for them I believe.
|
Ah. I guess clang is okay with __cdecl. Sadly, Gcc is not. |
|
❌ Build DirectXShaderCompiler 1.0.165 failed (commit 32dceb57e8 by @ehsannas) |
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
|
Hmm. Okay. I've angered googlebot again. I did discuss fixing the GCC build with @ehsannas. It turns out it's very trivial. Just adding the WinAdapter.h header to STLExtras.h and ConstantFolding.h. So you can accept the change or reject it and implement it yourself. I just thought it would be easier for me to investigate the problem since I have a gcc build at the ready. |
|
Thanks @pow2clk . Looks like this breaks the windows build too :( I didn't test it on windows locally. Seemed innocent enough... Will take a look tomorrow. |
|
Yeah. looks like WinAdapter.cpp is being included on Windows. I only did the GCC part because I thought it would save @ehsannas the trouble of setting up the build himself. I'm sure he can fix the windows build and I'm ambivalent about the best approach there anyway. So I'll happily leave the decision to him 😄 |
|
❌ Build DirectXShaderCompiler 1.0.166 failed (commit cd01a7caef by @pow2clk) |
pow2clk
left a comment
There was a problem hiding this comment.
I'm satisfied by your answers. I hope that the googlebot complaint isn't insurmountable. Is there something you can click to accept the change I made earlier? If not, I suppose you can always do a new pull request. annoying though.
| #include "llvm/Support/SMLoc.h" | ||
| #include <string> | ||
|
|
||
| #include "llvm/Support/WinSAL.h" |
There was a problem hiding this comment.
You can if you want. It seemed to build everywhere for me though in spite of that.
| } | ||
| void *CAllocator::Allocate(size_t nBytes) throw() { return malloc(nBytes); } | ||
| void CAllocator::Free(void *p) throw() { free(p); } | ||
|
|
There was a problem hiding this comment.
I'm happy either way. Just wanted to verify it wasn't an inadvertent omission.
|
✅ Build DirectXShaderCompiler 1.0.168 completed (commit 0dc875c959 by @ehsannas) |
|
Bots pass. |
No description provided.