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

Correctly guard SetHandleInformation API call #1296

Merged
merged 1 commit into from Nov 4, 2019
Merged

Correctly guard SetHandleInformation API call #1296

merged 1 commit into from Nov 4, 2019

Conversation

sylveon
Copy link
Contributor

@sylveon sylveon commented Nov 4, 2019

__cplusplus_winrt only detected C++/CX (which can be used without compiling for UWP, SetHandleInformation would be available in those cases), and did not detect native UWP C++. This patch fixes that by using the WINAPI_FAMILY_PARTITION macro in the Windows SDK headers in the same way those headers remove SetHandleInformation in UWP builds.

`__cplusplus_winrt` only detected C++/CX (which can be used without compiling for UWP, SetHandleInformation would be available in those cases), and did not detect native UWP C++. This patch fixes that by using the WINAPI_FAMILY_PARTITION macro in the Windows SDK headers in the same way those headers remove SetHandleInformation in UWP builds.
@sylveon
Copy link
Contributor Author

sylveon commented Nov 4, 2019

How would you feel about adding a [[maybe_unused]] to silence warnings on /W4 with MSVC?

@gabime gabime merged commit d67efb2 into gabime:v1.x Nov 4, 2019
@gabime
Copy link
Owner

gabime commented Nov 4, 2019

How would you feel about adding a [[maybe_unused]] to silence warnings on /W4 with MSVC?

Which warnings specifically? The problem is spdlog is c++11

@gabime
Copy link
Owner

gabime commented Nov 4, 2019

On second thought, What if windows sdk is not installed? will this break?

@sylveon
Copy link
Contributor Author

sylveon commented Nov 4, 2019 via email

@gabime
Copy link
Owner

gabime commented Nov 4, 2019

could manually disable the warning using pragmas

Before which line?

@gabime
Copy link
Owner

gabime commented Nov 4, 2019

Without the windows sdk, sethandleinformation or any windows header isn't
available at all.

Are you sure? I dont see any mention of this here

@sylveon
Copy link
Contributor Author

sylveon commented Nov 4, 2019 via email

@gabime
Copy link
Owner

gabime commented Nov 4, 2019

You mean FILE *f not being used if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM is not satisfied ?

@sylveon
Copy link
Contributor Author

sylveon commented Nov 4, 2019 via email

@gabime
Copy link
Owner

gabime commented Nov 4, 2019

The real problem is that this function would silently..

@gabime
Copy link
Owner

gabime commented Nov 4, 2019

Here is my shot at it. If SPDLOG_PREVENT_CHILD_FD is not defined(default) - then the entrire function will not be defined.

If SPDLOG_PREVENT_CHILD_FD is defined under winrt - then the lib won't compile - which is way better than failing silently.

@sylveon
Copy link
Contributor Author

sylveon commented Nov 4, 2019

Sounds like a valid option.

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

Successfully merging this pull request may close these issues.

None yet

2 participants