I'm trying to use SE-0443's new flag -Wwarning
with a nightly toolchain (swiftlang/swift:nightly-main-jammy
as of yesterday, Dec 17) and I'm getting the above mentioned error when compiling swift-nio:
❯ dsh swiftlang/swift:nightly-main-jammy
# bash
################################################################
# #
# Swift Nightly Docker Image #
# Tag: swift-DEVELOPMENT-SNAPSHOT-2024-12-13-a #
# #
################################################################
root@orbstack:/host# swift build -Xswiftc -Wwarning -Xswiftc concurrency
Building for debugging...
error: conflicting options '-Wwarning' and '-suppress-warnings'
error: conflicting options '-Wwarning' and '-suppress-warnings'
error: conflicting options '-Wwarning' and '-suppress-warnings'
[1/76] Compiling c-nioatomics.c
root@orbstack:/host#
(dsh
is an alias for docker run ... --entrypoint sh ...
)
SE-0443 says
It is forbidden to combine -suppress-warnings with -Wwarning or -Werror. The compiler will produce an error if these options are present in the command line together.
However, there's nowhere that I can see in NIO's - nor its dependencies' - manifests that is actually setting -suppress-warnings
. It's unclear to me what's causing the conflict or how to resolve it.
This doesn't seem to be a universal problem with -Wwarning
though. Trying the same command for another package does not raise this exact error:
root@orbstack:/host# swift build -Xswiftc -Wwarning -Xswiftc concurrency
Building for debugging...
<unknown>:0: warning: unknown warning group: 'concurrency'
<unknown>:0: warning: unknown warning group: 'concurrency'
/host/Sources/SemanticVersion/SemanticVersion.swift:143:1: warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
141 |
142 |
143 | extension Array: Comparable where Element == SemanticVersion.PreReleaseIdentifier {
| |- warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
| `- note: add '@retroactive' to silence this warning
144 | public static func < (lhs: Self, rhs: Self) -> Bool {
145 | // Per section 11.4 of the semver spec, compare left to right until a
<unknown>:0: warning: unknown warning group: 'concurrency'
<unknown>:0: warning: unknown warning group: 'concurrency'
<unknown>:0: warning: unknown warning group: 'concurrency'
/host/Sources/SemanticVersion/SemanticVersion.swift:143:1: warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
141 |
142 |
143 | extension Array: Comparable where Element == SemanticVersion.PreReleaseIdentifier {
| |- warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
| `- note: add '@retroactive' to silence this warning
144 | public static func < (lhs: Self, rhs: Self) -> Bool {
145 | // Per section 11.4 of the semver spec, compare left to right until a
[9/9] Emitting module SemanticVersion
Build complete! (3.14s)
It does however complain about the error group concurrency
. I've also tried -Wwarning deprecated
, which is explicitly mentioned in SE-0443`, but it raises the same problem.
I thought that perhaps the group names are entirely different and tried printing them via swift build -Xswiftc -print-diagnostic-groups
but it's not showing them:
root@orbstack:/host# swift build -Xswiftc -print-diagnostic-groups
Building for debugging...
/host/Sources/SemanticVersion/SemanticVersion.swift:143:1: warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
141 |
142 |
143 | extension Array: Comparable where Element == SemanticVersion.PreReleaseIdentifier {
| |- warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
| `- note: add '@retroactive' to silence this warning
144 | public static func < (lhs: Self, rhs: Self) -> Bool {
145 | // Per section 11.4 of the semver spec, compare left to right until a
/host/Sources/SemanticVersion/SemanticVersion.swift:143:1: warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
141 |
142 |
143 | extension Array: Comparable where Element == SemanticVersion.PreReleaseIdentifier {
| |- warning: extension declares a conformance of imported type 'Array' to imported protocol 'Comparable'; this will not behave correctly if the owners of 'Swift' introduce this conformance in the future
| `- note: add '@retroactive' to silence this warning
144 | public static func < (lhs: Self, rhs: Self) -> Bool {
145 | // Per section 11.4 of the semver spec, compare left to right until a
[9/9] Emitting module SemanticVersion
Build complete! (3.16s)
root@orbstack:/host#
So while the compiler doesn't complain about the flags being unsupported I still get the feeling I'm not using a toolchain that's got all the right bits available.
Is that perhaps what's happening here? Or is there something else I'm doing wrong?
(As far as I can see there's no upcoming feature flag for SE-0443 that I should be setting in order to enable support for -Wwarning
.)
Any pointers greatly appreciated!