-
Notifications
You must be signed in to change notification settings - Fork 204
SwiftDriver: change the response file emission #1000
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please test |
cltnschlosser
approved these changes
Jan 28, 2022
This adjusts the response file emission to follow the clang behaviour. Doing so allows the use of response files on Windows to be passed to clang, which will default to POSIX style response files unless explicitly passed `--rsp-quoting=windows`. This allows for a single path for the emission across platforms, and avoids having to deal with the dynamic switching of the response file formats. With this change, ignoring the serialization issue, it is now possible to build swift-driver with swift-driver.
artemcm
approved these changes
Jan 28, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How fitting for PR #1000.
Thank you!
@swift-ci please test |
Awesome! |
ahoppen
added a commit
to ahoppen/swift
that referenced
this pull request
Oct 17, 2024
clang parses response files in GNU mode, even on Windows except - If you explicitly pass `--rsp-quoting=windows` in the command line invocation or - If no `--rsp-quoting` is specified and clang is running `cl` mode, which is the case if clang is invoked as `cl` or `clang-cl`, which is the compatibility mode to Window’s `cl` compiler as far as I can tell. The Swift driver always outputs response files in GNU mode (swiftlang/swift-driver#1000). Since Swift does not need to support a compatibility mode with another compiler, there is no need for it to parse response files in Windows mode. We should unconditionally parse the response files in GNU mode.
ahoppen
added a commit
to ahoppen/swift
that referenced
this pull request
Oct 17, 2024
clang parses response files in GNU mode, even on Windows except - If you explicitly pass `--rsp-quoting=windows` in the command line invocation or - If no `--rsp-quoting` is specified and clang is running `cl` mode, which is the case if clang is invoked as `cl` or `clang-cl`, which is the compatibility mode to Window’s `cl` compiler as far as I can tell. The Swift driver always outputs response files in GNU mode (swiftlang/swift-driver#1000). Since Swift does not need to support a compatibility mode with another compiler, there is no need for it to parse response files in Windows mode. We should unconditionally parse the response files in GNU mode.
ahoppen
added a commit
to ahoppen/swift-driver
that referenced
this pull request
Oct 17, 2024
swiftlang#1000 switched to use POSIX-style response files but swift-frontend expects Windows-style response files on Windows. Switch back to generating Windows-style response files on Windows and pass `--rsp-quoting=windows` to `clang` to tell it to pass the response file in Windows mode. Alternatives considered: - Have a separate response file generation logic for clang and Swift: This seems like a continuous source of bugs if you always need to think about which response file format you want, especially if the behavior is not intuitive (`clang.exe` expecting POSIX-style response files) - Instead of parsing `--rsp-quoting=windows` on Windows, use `clang-cl.exe`, which also causes response files to be parsed in Windows-style: I think it’s better to be explicit here instead of relying on clang’s implicit behavior based on which executable name was invoked. - Change swift-frontend to accept POSIX-style response files: swift-frontend and the old Swift driver share the same response file parsing logic. Changing swift-frontend without changing the old driver would require a bunch of flag parsing, which isn’t desirable. Also, using Windows-style response files on Windows seems like the better-fitting solution (CMake, for example, outputs Windows-style response files). Reverts swiftlang#1000 with some logic added on top.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adjusts the response file emission to follow the clang behaviour.
Doing so allows the use of response files on Windows to be passed to
clang, which will default to POSIX style response files unless
explicitly passed
--rsp-quoting=windows
. This allows for a singlepath for the emission across platforms, and avoids having to deal with
the dynamic switching of the response file formats. With this change,
ignoring the serialization issue, it is now possible to build
swift-driver with swift-driver.