[cfe-commits] [Patch] Improve diagnostics on gnu attributes

Michael Han Michael.Han at autodesk.com
Sun Apr 10 21:17:49 PDT 2011


Consider this code:

int a;
__attribute__((noreturn(a))) void foo();

Clang does not emit any warning or errors on this code; gcc would report wrong number of arguments for the attribute specified.
The attached patch fixed this by emit a "takes no argument" error for clang.

Alternatively parser can be updated so the first identifier immediately following the attribute name could be treated as argument, instead of "parameter" (what is the difference between them?). This would require a lot more work to update the parser and the AttributeList so I am not sure if that is the right thing to do for now. Please review the patch thanks

Cheers
~Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110411/85abf93d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attributes.fix.patch
Type: application/octet-stream
Size: 5140 bytes
Desc: attributes.fix.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110411/85abf93d/attachment.obj>


More information about the cfe-commits mailing list