Page MenuHomePhabricator

Don't emit `-Wnullability-completeness` warnings on `weak` Objective-C properties.
Needs ReviewPublic

Authored by mwyman on Jun 16 2022, 11:12 PM.



Zeroing weak references are by definition nullable, and adding nonnull or _Nonnull yields a mutual-exclusivity error. However, when -Wnullability-completeness is enabled, in non-audited header regions it's necessary to add the nullable property keyword to avoid a warning. It should not be necessary to add code clutter to restate the nullability of a weak property even under -Wnullability-completeness.

Additionally, the fix-it hints are both non-idiomatic Objective-C (adding _Nullable to the property's pointer type rather than in the @property attributes) and suggest the option of adding _Nonnull (which would be an error).

Diff Detail

Event Timeline

mwyman created this revision.Jun 16 2022, 11:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2022, 11:12 PM
mwyman requested review of this revision.Jun 16 2022, 11:12 PM
mwyman updated this revision to Diff 440390.Jun 27 2022, 2:10 PM

Adding Doug Gregor who appears to have created the original warning.