[cfe-commits] r152271 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/AnalysisBasedWarnings.cpp test/FixIt/fixit-recursive-block.c

Jordan Rose jediknil at belkadan.com
Wed Mar 7 16:42:01 PST 2012


On Mar 7, 2012, at 16:22, Fariborz Jahanian wrote:

> Author: fjahanian
> Date: Wed Mar  7 18:22:50 2012
> New Revision: 152271
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=152271&view=rev
> Log:
> improve on diagnostic and provide a fixit hint when
> an uninitialized block variable is being called inside the
> block literal. // rdar://10817031
> 

I'm not a fan of the fixit wording... __block doesn't "silence" the warning, it changes the semantics. Admittedly, the original semantics are wrong and this is almost certainly the right fix, but it is a real change. How about something like "maybe you meant to use __block?"

(I don't like that so much either because it doesn't directly say WHY this fixes the problem, but I don't have a better alternative, and I guess the warning text does do that already.)

Jordy


> +
> +int main() {
> +    void (^arc_fail)() = ^() {  // expected-warning {{block pointer variable 'arc_fail' is uninitialized when captured by block}} \
> +                                // expected-note {{consider using a '__block' variable 'arc_fail' to silence this warning}}
> +       arc_fail(); // BOOM
> +    };
> +}
> +// CHECK: {7:12-7:12}:"__block "
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list