1.. title:: clang-tidy - bugprone-macro-parentheses 2 3bugprone-macro-parentheses 4========================== 5 6 7Finds macros that can have unexpected behavior due to missing parentheses. 8 9Macros are expanded by the preprocessor as-is. As a result, there can be 10unexpected behavior; operators may be evaluated in unexpected order and 11unary operators may become binary operators, etc. 12 13When the replacement list has an expression, it is recommended to surround 14it with parentheses. This ensures that the macro result is evaluated 15completely before it is used. 16 17It is also recommended to surround macro arguments in the replacement list 18with parentheses. This ensures that the argument value is calculated 19properly. 20 21This check corresponds to the CERT C Coding Standard rule 22`PRE20-C. Macro replacement lists should be parenthesized. 23<https://wiki.sei.cmu.edu/confluence/display/c/PRE02-C.+Macro+replacement+lists+should+be+parenthesized>`_ 24