C++: Initial commit of cpp/comma-before-missing-indentation

This commit is contained in:
Nora Dimitrijević
2022-09-22 17:06:04 +02:00
parent 6e6880bbe4
commit f1efc76e8c
6 changed files with 40 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>...</p>
</overview>
<recommendation>
<p>...</p>
</recommendation>
<example>
<sample src="CommaBeforeMisleadingIndentation.cpp" />
</example>
</qhelp>

View File

@@ -0,0 +1 @@
select 1

View File

@@ -0,0 +1 @@
Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql

View File

@@ -0,0 +1,19 @@
void test(int i, int j, int (*foo)(int))
{
if (i)
(void)i, // GOOD
(void)j;
if (i)
(void)i, // BAD
(void)j;
foo((i++, j++)); // GOOD
foo((i++, // GOOD
j++));
foo((i++
, j++)); // GOOD
foo((i++,
j++)); // BAD (?)
}