[cfe-commits] [patch] warn on missing [super finalize] call

Nico Weber thakis at chromium.org
Mon Aug 29 16:00:58 PDT 2011

On Mon, Aug 29, 2011 at 6:25 PM, Ted Kremenek <kremenek at apple.com> wrote:
> To put it more clearly: you *can't* use ARC with GC, and -finalize is very specific to GC.  If and when we support a hybrid ARC/GC mode, that would be properly supported in the LangOptions.  One shouldn't suggest calling [super finalize] in ARC because that doesn't make any sense.

Neither does having a finalize method at all :-) Since ARC mode
doesn't warn about finalize, I figured a finalize method with a [super
finalize] call is better than one without.

I disabled the warning in ARC mode in r138776.

> On Aug 28, 2011, at 3:34 PM, Nico Weber wrote:
>> On Sun, Aug 28, 2011 at 6:58 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
>>> LGTM. I am not sure though that this warning, like the other one, makes any sense in arc mode.
>>> You may want to turn it off in arc mode.
>> My reasoning was: If one enables both arc and garbage collection
>> (which doesn't make much sense), then the compiler will automatically
>> insert retain/release calls (arc) which are noops (gc). Getting
>> finalize right in this mode is still important. (But I guess not many
>> will use arc with gc, so it doesn't matter much either way.)
>> Nico
>>> - Fariborz
>>> On Aug 28, 2011, at 2:58 AM, Nico Weber wrote:
>>>> Hi,
>>>> the attached patch makes clang warn on missing [super finalize] calls.
>>>> The warning uses the same logic as gcc (
>>>> http://codesearch.google.com/#N01oSP8jpDo/gcc/objc/objc-act.c , search
>>>> for "should_call_super_finalize" in that file). This is half of
>>>> PR10661.
>>>> This follows Fariborz' advice from
>>>> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110822/045443.html
>>>> . I added OMF_finalize to a few switch statements, mostly to fix
>>>> "unhandled value in switch" warnings – I tried to add it so that it
>>>> didn't change the previous semantics.
>>>> Ok?
>>>> Nico
>>>> <clang-missing-finalize.patch>_______________________________________________
>>>> 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

More information about the cfe-commits mailing list