Skip to content

Guard macro declarations behind hasFeature(Macros) #1071

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
Dec 5, 2024

Conversation

DougGregor
Copy link
Member

To enable building this package with a "minimal" Swift toolchain whose compiler does not have support for macros, guard the macro declarations behind #if hasFeature(Macros). This has no effect on anything but the toolchain bootstrap process.

To enable building this package with a "minimal" Swift toolchain whose
compiler does not have support for macros, guard the macro declarations
behind `#if hasFeature(Macros)`. This has no effect on anything but the
toolchain bootstrap process.
@DougGregor
Copy link
Member Author

@swift-ci please test

@@ -27,6 +27,8 @@ public struct Expression<each Input, Output> : Sendable {
}
}

#if hasFeature(Macros)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just confirming, do we need to worry about this in our unit tests which use the macro or are we not expected to ever try to build tests with a minimal compiler?

Additionally, do we need to handle avoiding building the macro itself? IIRC if the cmake build is not provided with a path to the built macro, it will attempt to build the macro automatically and SwiftPM builds will always build the macro. I suspect that we don't expect to be able to build via SwiftPM with a minimal toolchain, but is there anything that needs to be done on the CMake side to avoid invoking a build of the macro library when the compiler doesn't have this feature?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, we don't have to worry about tests. We don't care whether that first stage passes tests, it just needs to build the second stage.

I don't think we need to avoid building the macro library, either. It's just unused.

@DougGregor DougGregor merged commit 4823a26 into swiftlang:main Dec 5, 2024
3 checks passed
@DougGregor DougGregor deleted the cxx-bootstrap-fix branch December 5, 2024 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.

2 participants