Skip to content

stdlib: adjust the shims for MSVC mode compilation #19277

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

Merged
merged 1 commit into from
Sep 13, 2018

Conversation

compnerd
Copy link
Member

The SwiftStdint.h header is used in the compiler as well. The compiler may be
built with cl (Visual Studio) on Windows, which does not define
__INTPTR_TYPE__ nor does it define __INTPTR_WIDTH__. Simply define the
__swift_{,u}intptr_t typedefs as Microsoft does on that platform when building
with Visual Studio.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

The SwiftStdint.h header is used in the compiler as well.  The compiler may be
built with cl (Visual Studio) on Windows, which does not define
`__INTPTR_TYPE__` nor does it define `__INTPTR_WIDTH__`.  Simply define the
`__swift_{,u}intptr_t` typedefs as Microsoft does on that platform when building
with Visual Studio.
@compnerd
Copy link
Member Author

CC: @gparker42

@compnerd
Copy link
Member Author

@swift-ci please test

@jrose-apple
Copy link
Contributor

cc @mikeash

This doesn't seem correct to me. The runtime is always supposed to be compiled with the just-built Clang, not the system compiler, so that it can use swiftcc on platforms that support it.

@mikeash
Copy link
Contributor

mikeash commented Sep 12, 2018

There's a SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER option, which I guess is what would need this change.

@compnerd
Copy link
Member Author

@jrose-apple I saw bits of this being included indirectly into the compiler. Unfortunately, I don't have the include path off hand. The runtime currently requires clang to build since we use special calling conventions in the runtime, so SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER is really a misnomer. I suppose I should add a guard to ensure that if SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER is set to true, that the host compiler is clang.

@compnerd
Copy link
Member Author

@mikeash - okay to merge then? Is there a better way to accommodate this?

@compnerd
Copy link
Member Author

I suppose I should add a guard to ensure that if SWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER is set to true, that the host compiler is clang.

Upon further inspection, seems that we're ahead of me: stdlib/CMakeLists.txt already does this on L5-10 ❤️

@mikeash
Copy link
Contributor

mikeash commented Sep 13, 2018

Seems like the right way to fix this to me.

@compnerd compnerd merged commit 7912da4 into swiftlang:master Sep 13, 2018
@compnerd compnerd deleted the msvc-shims branch September 13, 2018 19:24
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.

3 participants