Yeah, this is another thing I wanted to discuss. They do behave like they are deprecated declarations but AFAIK we don't have a concept of deprecated protocol requirement in the language, so such warnings can only be expressed as special cases in the compiler. Do they still should be considered part of the DeprecatedDeclaration
group?
I'd say yesâpossibly with a subgroup of DeprecatedProtocolRequirement
?
My rationale is this: These groups are for end users and ought to be comprehensible (in their grouping) to them. How something is implemented as a special case is sort of immaterial from that perspective.
I'm a bit worried that with only a subject part in a group name, we may face some naming difficulties in the future. Consider the possibility that one day the compiler will diagnose another warning for the same attribute, something like "@_implementationOnly attribute is used for a non-resilient module that wasn't prepared for it".
We will have two warnings: ImplementationOnlyAttribute
and ImplementationOnlyAttribute(some_suffix)
. It's a bit confusing.
I'd love to give all the groups short names, but I'm afraid of shortening them based on today's set of diagnostics.
Let's focus on DeprecatedDeclaration
then. I'm removing everything else from the PR and merging DeprecatedExecutorEnqueueOwnedJobImplementation
and DeprecatedHashValueImplementation
into DeprecatedDeclaration
.
I think we are better not to give them a dedicated group (i.e. DeprecatedProtocolRequirement
) since we're not providing DeprecatedWitness
or DeprecatedConformance
.
But I think in one of the next iterations we might bring DeprecatedExecutorEnqueueOwnedJobImplementation
back because it should probably belong to a supergroup about concurrency warnings as well.
Hey all,
I've been looking to unify this functionality with that of educational notes. We're discussing the user experience of educational notes in a separate thread, if anyone watching here is interested.
Doug
Is this feature fully functional in Xcode 16.3 betas? I've tried using it but haven't gotten far, it's unclear to me if I'm using the wrong identifiers (I've read through the thread) or the flags work differently than I thought they would.
In other words setting SWIFT_TREAT_WARNINGS_AS_ERRORS = YES
and SWIFT_WARNINGS_AS_WARNING_GROUPS = "DeprecatedDeclaration"
doesn't seem to stop any deprecation warnings from being treated as errors. I tried a number of other identifiers suggested in this thread as well.
Xcode 16.3 ships with Swift 6.1, which supports the feature, so yes.
DeprecatedDeclaration
is the correct spelling.
This part of the question is about how Swift Build handles these settings. So, I think it's better to ask this question here.
But from what I can say, most likely the order of the flags when calling the compiler was incorrect: -Wwarning
precedes -warnings-as-errors
.
Try to remove SWIFT_WARNINGS_AS_WARNINGS_GROUPS
(also note it's all plural) and SWIFT_TREAT_WARNINGS_AS_ERRORS
and set
OTHER_SWIFT_FLAGS = "-warnings-as-errors -Wwarning DeprecatedDeclaration";
Thanks, that was helpful. I tried out doing the opposite (TREAT_WARNINGS_AS_ERRORS = NO
and `SWIFT_ERROR_AS_WARNING_GROUPS = "DeprecatedDeclaration") and it did the "right" thing.
Setting the flags by hand as you suggested also worked out, finally .
I'm guessing the problem here is that, when setting those flags through the build settings UI, Xcode 16.3 applies those flags in the reverse order of the one that most users would want.
I guess trying to avoid having those flags have a different behaviors depending on their order isn't something we'd contemplate at this point âI really don't know how common this approach is to begin with, I very rarely deal with the compiler without an IDE in the middleâ.
Which diagnostic groups were implemented? The only two I can seem to find any documentation for is DeprecatedDeclaration
and UnknownWarningGroup
. Is there a list of the latest warning suppressions we can enable in Swift 6.1?
When I compile with -print-diagnostic-groups
I see a group for DeprecatedDeclaration but I don't see a diagnostic group for other warnings:
// diagnostic group [DeprecatedDeclaration]
- warning: 'contentEdgeInsets' was deprecated in iOS 15.0: This property is ignored when using UIButtonConfiguration [DeprecatedDeclaration]
// no diagnostic group
- warning: 'UIKit' inconsistently imported as implementation-only
// no diagnostic group
- warning: using '@_implementationOnly' without enabling library evolution may lead to instability during execution
not an authority on this question, but these might be the ones to try (just looking at what's in DiagnosticGroups.def
on the 6.1 release branch).