[cfe-dev] Repeated parameter with side effects passed to macro

Anders Rönnholm Anders.Ronnholm at evidente.se
Fri Mar 27 05:49:47 PDT 2015


Hi!

I have implemented a proof-of-concept clang-tidy checker for this CERT rule:

https://www.securecoding.cert.org/confluence/display/c/PRE31-C.+Avoid+side+effects+in+arguments+to+unsafe+macros

The checker seems to work. It warns if a macro argument has side effects and it is repeated in the macro. Currently it only warns for ++ and -- but this can be improved.

The error message can probably be tweaked. Feel free to suggest a better message.

Is this approach looking good or should the checker be moved/redesigned?

Best Regards,
AR
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150327/afcd5426/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MacroRepeated.diff
Type: application/octet-stream
Size: 11789 bytes
Desc: MacroRepeated.diff
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150327/afcd5426/attachment.obj>


More information about the cfe-dev mailing list