On Aug 14, 2009, at 2:51 PM, Eli Friedman wrote:
On Fri, Aug 14, 2009 at 1:51 PM, Ted Kremenek<[email protected]>
wrote:
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Aug 14 15:51:58 2009
@@ -438,13 +438,14 @@
return;
}
- if (!isFunction(d)) {
+ const FunctionDecl *FD = dyn_cast<FunctionDecl>(d);
+
+ if (!FD) {
S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
<< Attr.getName() << 0 /*function*/;
return;
}
Unless I'm mistaken, this breaks constructs like the following:
__attribute((malloc)) void *(*f)();
-Eli
I implemented handling of this case, but I noticed that GCC actually
rejects attribute 'malloc' being applied to function pointers
("warning: 'malloc' attribute ignored"). Should we do the same in
Clang? For function pointers, the malloc attribute really a property
of the pointer type, not the declaration, but apparently GCC doesn't
even reason about that._______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits