diff options
author | Samuel Benzaquen <sbenza@google.com> | 2016-04-14 21:15:57 +0000 |
---|---|---|
committer | Samuel Benzaquen <sbenza@google.com> | 2016-04-14 21:15:57 +0000 |
commit | 4fa2d57c6db8c7c5e017761643606697c050787c (patch) | |
tree | b5d64e06f0870cbd790306e8334bec61808321c8 /clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst | |
parent | 1ca263c8903b765349d48490de1bfa7def0dc48d (diff) | |
download | bcm5719-llvm-4fa2d57c6db8c7c5e017761643606697c050787c.tar.gz bcm5719-llvm-4fa2d57c6db8c7c5e017761643606697c050787c.zip |
[clang-tidy] Add check misc-multiple-statement-macro
Summary:
The check detects multi-statement macros that are used in unbraced conditionals.
Only the first statement will be part of the conditionals and the rest will fall
outside of it and executed unconditionally.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18766
llvm-svn: 266369
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst')
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst new file mode 100644 index 00000000000..b2b47601929 --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-multiple-statement-macro.rst @@ -0,0 +1,16 @@ +.. title:: clang-tidy - misc-multiple-statement-macro + +misc-multiple-statement-macro +============================= + +Detect multiple statement macros that are used in unbraced conditionals. +Only the first statement of the macro will be inside the conditional and the other ones will be executed unconditionally. + +Example: + +.. code:: c++ + + #define INCREMENT_TWO(x, y) (x)++; (y)++ + if (do_increment) + INCREMENT_TWO(a, b); // `(b)++;` will be executed unconditionally. + |