[cfe-dev] False positive warning: "warning: 'terminate:' is deprecated"?

Nico Weber thakis at chromium.org
Tue Dec 13 12:20:43 PST 2011


This breaks the chromium build with the 10.6 sdk. So the recommended
fix is to explicitly typecast NSApp everywhere it's used?

On Mon, Dec 12, 2011 at 11:10 AM, jahanian <fjahanian at apple.com> wrote:
>
> On Dec 12, 2011, at 10:34 AM, Eli Friedman wrote:
>
>> On Mon, Dec 12, 2011 at 10:17 AM, Sean McBride <sean at rogue-research.com> wrote:
>>> Hi all,
>>>
>>> With clang version 3.1 (trunk 146375) the code below generates a false positive warning:
>>>
>>> test.m:7:6: warning: 'terminate:' is deprecated [-Wdeprecated-declarations]
>>>    [NSApp terminate:nil];
>>>     ^
>>>
>>> As best as I can tell, that method is not deprecated.  The global variable NSApp is declared as 'id'.  If I cast it to NSApplication* the warning goes away.  This warning did not occur a few weeks ago, nor does it with gcc.
>>>
>>> Is it a bug or am I missing something?
>>
>> This change was made intentionally in r145999.  There are multiple
>> methods called terminate in Cocoa.h, and one of them (specifically,
>> the one on NSInputServiceProvider) is deprecated.  It's possible the
>> heuristic and/or the headers need tweaks.
>
> That is correct. This was intentionally done on user request when receiver type is 'id' and there is at least one deprecated method
> of the given name. Type-cast always removes the warning.
>
> - Fariborz
>
>>
>> -Eli
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list