r205024 - Objective-C. revert r204965. This will make

Ted Kremenek kremenek at apple.com
Fri Mar 28 15:38:51 PDT 2014


Hi Nico,

The discussion was in person, in a hallway.  We don’t discuss everything over email.  :)  I do agree that there should have been a bit more information here on the intended design.

The idea for the fixit is to provide a way for a user to silence the warning when they “know what they are doing”.  I suggested:

  @selector((…))

notice the double ‘((‘.  Essentially it matches the idiom provided by -Wparenthesis.

What do you think?

Cheers,
Ted

On Mar 28, 2014, at 11:59 AM, Nico Weber <thakis at chromium.org> wrote:

> Can you share the idea for the fix-it? And maybe this shouldn't be on by default until the fix-it is implemented?
> 
> As is, this will warn if someone writes @selector(length) and includes Cocoa, which doesn't seem very unlikely – and warning on that without a workaround doesn't seem useful.
> 
> (Also, it'd be nice if the discussion was on-list.)
> 
> 
> On Fri, Mar 28, 2014 at 11:22 AM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> Author: fjahanian
> Date: Fri Mar 28 13:22:16 2014
> New Revision: 205024
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=205024&view=rev
> Log:
> Objective-C. revert r204965. This will make
> -Wselector-type-mismatch default again. After
> internal discussions, we think that in most cases
> it has helped our developers find hard to detect
> undefined behaviors. We are going to provide a syntax
> (and fix-it) to suppress the warning in remaining of
> false positive cases.
> 
> Modified:
>     cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>     cfe/trunk/test/SemaObjC/selector-1.m
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=205024&r1=205023&r2=205024&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Mar 28 13:22:16 2014
> @@ -907,7 +907,7 @@ def warn_unimplemented_protocol_method :
>  def warning_multiple_selectors: Warning<
>    "several methods with selector %0 of mismatched types are found "
>    "for the @selector expression">,
> -  InGroup<SelectorTypeMismatch>, DefaultIgnore;
> +  InGroup<SelectorTypeMismatch>;
>  // C++ declarations
>  def err_static_assert_expression_is_not_constant : Error<
>    "static_assert expression is not an integral constant expression">;
> 
> Modified: cfe/trunk/test/SemaObjC/selector-1.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/selector-1.m?rev=205024&r1=205023&r2=205024&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaObjC/selector-1.m (original)
> +++ cfe/trunk/test/SemaObjC/selector-1.m Fri Mar 28 13:22:16 2014
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -Wselector-type-mismatch -verify %s
> +// RUN: %clang_cc1 -verify %s
> 
>  @interface I
>  - (id) compare: (char) arg1; // expected-note {{method 'compare:' declared here}}
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140328/dcb098a0/attachment.html>


More information about the cfe-commits mailing list