[cfe-commits] r120872 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/warn-unused-function.c
rjmccall at apple.com
Mon Dec 6 14:48:35 PST 2010
On Dec 6, 2010, at 2:34 PM, Douglas Gregor wrote:
> On Dec 6, 2010, at 10:33 AM, John McCall wrote:
>> It could be dependent if we implemented overloading on it. :)
>> I'm not sure why __attribute__((cleanup("foo"))) is different from, say, an explicit call to (foo)(x), or &foo. In all of these cases, from the user's perspective the function is used, because their code probably won't compile if you remove the declaration. So you should still use MarkDeclarationReferenced, and if we want to teach MarkDeclarationReferenced about this user notion of a dependent use, we've got one place to change.
> I disagree with "from the user's perspective the function is used". The function declaration is needed, sure, but that's very different from "used" in the ODR sense, which implies that we need to have a definition. And I think that user's don't expect to need definitions for something that's only used in an uninstantiated template.
Right, so we clearly wouldn't want this "user" sense of "used" to cause instantiation, much less code emission. But it would be nice for -Wunused-function not to suggest removing function definitions when doing so will cause the code to stop compiling.
More information about the cfe-commits