Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

[linux-port] Use WinAdapter.h instead of Win*.h - #237

Merged
ehsannas merged 4 commits into
google:linuxfrom
ehsannas:fix_h
Jun 7, 2018
Merged

ehsannas merged 4 commits into
google:linuxfrom
ehsannas:fix_h

Conversation

@ehsannas

@ehsannas ehsannas commented Jun 6, 2018

Copy link
Copy Markdown

No description provided.

ehsannas added 2 commits June 6, 2018 15:09
Also MS requested that we separate out the declaration and definition of
types where possible.
@ehsannas ehsannas self-assigned this Jun 6, 2018
@ehsannas
ehsannas requested a review from pow2clk June 6, 2018 20:39
@ehsannas

ehsannas commented Jun 6, 2018

Copy link
Copy Markdown
Author

It turned out to be a nice change at the end! :)

@pow2clk pow2clk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this means it's verified?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.


#include "llvm/Support/Compiler.h"
#include "llvm/Support/WinSAL.h"
#include <algorithm> // for std::all_of

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I think I'll add this back.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't WinFunctions.cpp be appended here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't all of them moved to WinAdapter.cpp? Because they aren't windows classes I guess?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pow2clk

pow2clk commented Jun 6, 2018

Copy link
Copy Markdown

Ah. I guess clang is okay with __cdecl. Sadly, Gcc is not. ☹️

@AppVeyorBot

Copy link
Copy Markdown

@googlebot

Copy link
Copy Markdown

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 cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@pow2clk

pow2clk commented Jun 6, 2018

Copy link
Copy Markdown

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.

@ehsannas

ehsannas commented Jun 6, 2018

Copy link
Copy Markdown
Author

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.

@pow2clk

pow2clk commented Jun 6, 2018

Copy link
Copy Markdown

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 😄

@AppVeyorBot

Copy link
Copy Markdown

@pow2clk pow2clk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy either way. Just wanted to verify it wasn't an inadvertent omission.

@AppVeyorBot

Copy link
Copy Markdown

@ehsannas

ehsannas commented Jun 7, 2018

Copy link
Copy Markdown
Author

Bots pass.

@ehsannas
ehsannas merged commit 59d7235 into google:linux Jun 7, 2018
@ehsannas
ehsannas deleted the fix_h branch June 7, 2018 18:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants