Skip to content

Added MSVC definitions for the DISPATCH_* macros in dispatch/base.h #376

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
Jun 27, 2018
Merged

Added MSVC definitions for the DISPATCH_* macros in dispatch/base.h #376

merged 1 commit into from
Jun 27, 2018

Conversation

dplanitzer
Copy link

Added MSVC specific definitions of the DISPATCH_* macros to dispatch/base.h. This is one necessary step to make it possible to compile the Swift APIs for ibdispatch. E.g. we need a working definition of DISPATCH_NORETURN to ensure that we can successfully compile his function:

public func dispatchMain() -> Never { CDispatch.dispatch_main() }

because its return type is Never.

DISPATCH_* macros which are empty are empty because MSVC has no equivalent to the corresponding clang / gcc attribute.

@dplanitzer
Copy link
Author

cc @MadCoder @compnerd

@MadCoder
Copy link
Contributor

@swift-ci please test

@compnerd
Copy link
Member

This is generally not going to end very well. MSVC doesn't support the swift calling convention nor does it support Blocks. How do you intend to deal with those?

@MadCoder
Copy link
Contributor

I think this is more about allowing people to use libdispatch on windows with MSVC, which is IMO sth we should do.

building libdispatch with MSVC makes no sense, but we should support using it in a project.

@MadCoder
Copy link
Contributor

(as in maybe it's not why @dplanitzer was doing it, but we should still do it anyway for the reason I just gave)

@MadCoder MadCoder merged commit 631821c into swiftlang:master Jun 27, 2018
@dplanitzer
Copy link
Author

MadCoder stated one reason.

The other reason is that we need proper definitions for macros like DISPATCH_NORETURN for building libdispatch for Swift with the Swift compiler / clang-cl.

Previously compiling the Swift overlay (specifically the Swift function dispatchMain) would fail because the prototype for the dispatch_main function was missing the noreturn annotation.

@dplanitzer dplanitzer deleted the msvc_definitions_for_dispatch_base_h branch June 27, 2018 21:45
ktopley-apple pushed a commit that referenced this pull request Dec 6, 2018
…_base_h

Added MSVC definitions for the DISPATCH_* macros in dispatch/base.h

Signed-off-by: Kim Topley <ktopley@apple.com>
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.

4 participants