[PATCH] D34264: Introduce -Wunguarded-availability-new, which is like -Wunguarded-availability, except that it's enabled by default for new deployment targets

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 17:42:56 PDT 2017

dexonsmith added inline comments.

Comment at: lib/Sema/SemaDeclAttr.cpp:7031
+            Introduced) &&
+        !S.Diags.isIgnored(diag::warn_unguarded_availability_new, Loc);
+    diag = NewWarning ? diag::warn_partial_availability_new
arphaman wrote:
> erik.pilkington wrote:
> > Sorry to keep this going so long, but why are we even checking isIgnored? The only difference it could make in whether we emit a diagnostic is if both: -Wunguarded-availability and -Wno-unguarded-availability-new are passed in, which seems like it would never happen, right? Even if somebody did pass that in, it seems reasonable to warn on old stuff but not new stuff. Maybe I'm missing something here?
> Right, it's to handle the `-Wunguarded-availability -Wno-unguarded-availability-new` case. Your argument makes sense though, we could allow `-Wunguarded-availability -Wno-unguarded-availability-new` where we warn on old APIs. Although that still seems kinda weird to me. Maybe @dexonsmith has an opinion about this?
I don't think the exact behaviour of `-Wunguarded-availability -Wno-unguarded-availability-new` is terribly important.  I'm fine either way.

But, having a predictable command-line interface is nice, and I'd expect that combination to show diagnostics only for old APIs.



More information about the cfe-commits mailing list