<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 14, 2009, at 3:20 PM, Eli Friedman wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">On Fri, Aug 14, 2009 at 3:12 PM, Ted Kremenek<<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>> wrote:<br><blockquote type="cite">Unless I'm mistaken, this breaks constructs like the following:<br></blockquote><blockquote type="cite">__attribute((malloc)) void *(*f)();<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-Eli<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I implemented handling of this case, but I noticed that GCC actually rejects<br></blockquote><blockquote type="cite">attribute 'malloc' being applied to function pointers ("warning: 'malloc'<br></blockquote><blockquote type="cite">attribute ignored").  Should we do the same in Clang?  For function<br></blockquote><blockquote type="cite">pointers, the malloc attribute really a property of the pointer type, not<br></blockquote><blockquote type="cite">the declaration, but apparently GCC doesn't even reason about that.<br></blockquote><br>I think it's better to be self-consistent here over being consistent<br>with gcc, as long as we don't break compatibility.  Function<br>attributes are confusing enough without making different attributes<br>act differently.<br></span></blockquote><br></div><div>Thanks for the feedback Eli.  In the case of function pointers, I'm not certain what value there is with attaching the 'malloc' attribute to variable declarations.  The proper way to handle function pointer seems (to me) to associate it with the type.  Since this is a GCC extension, I'd rather follow GCC's more limited functionality here than have a half-baked one for function pointers unless we want to really handle it properly.</div></body></html>