[PATCH] D33816: [Sema][ObjC] Don't allow -Wunguarded-availability to be silenced with redeclarations

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 03:00:08 PDT 2017


arphaman added a comment.

I don't think the new warning is ideal, e.g.:

  #import <Cocoa/Cocoa.h>
  
  __attribute__((visibility("default"))) __attribute__((availability(macosx,introduced=10_10)))
  @interface Test : NSObject
  
  @end
  
  Test *testVar;

E.g.:

  test.m:13:1: warning: 'Test' is partial: introduced in macOS 10.10 [-Wunguarded-availability]
  Test *testVar;
  ^
  test.m:6:12: note: 'Test' has been explicitly marked partial here
  @interface Test : NSObject
             ^
  test.m:13:7: note: annotate 'Test' with an availability attribute to silence
  Test *testVar;
        ^

We are telling the user to annotate the class 'Test' with an availability attribute, but that class is already annotated with the attribute in the framework!
We should either refer to the `testVar` declaration, or say something like `annotate the declaration that uses 'Test' .....`.


https://reviews.llvm.org/D33816





More information about the cfe-commits mailing list