On Aug 14, 2009, at 2:53 PM, Ted Kremenek wrote:


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

Thanks for pointing this out.  I'll fix it.

Incidentally, the previous code didn't explicitly handle that case either. The return type of the function pointer wouldn't actually be checked to see if it was a pointer.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to