[Bug c/80116] Warn about macros expanding to multiple statements
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 20 15:29:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80116
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-03-20
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed. The CERT C Coding Standard outlines a number of common problems
with macros that might be worth considering for inclusion in the proposed
warning. The following is the subject of this enhancement request:
PRE10-C. Wrap multistatement macros in a do-while loop
https://www.securecoding.cert.org/confluence/x/jgL7
Some other checkers:
PRE01-C. Use parentheses within macros around parameter names
https://www.securecoding.cert.org/confluence/x/CgU
PRE02-C. Macro replacement lists should be parenthesized
https://www.securecoding.cert.org/confluence/x/HAs
PRE11-C. Do not conclude macro definitions with a semicolon
https://www.securecoding.cert.org/confluence/x/wgBlAQ
PRE12-C. Do not define unsafe macros
https://www.securecoding.cert.org/confluence/x/TIF3Ag
PRE31-C. Avoid side effects in arguments to unsafe macros
https://www.securecoding.cert.org/confluence/x/agBi
More information about the Gcc-bugs
mailing list