Skip to content

Commit f1efc76

Browse files
committed
C++: Initial commit of cpp/comma-before-missing-indentation
1 parent 6e6880b commit f1efc76

File tree

6 files changed

+40
-0
lines changed

6 files changed

+40
-0
lines changed

cpp/ql/src/Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.cpp

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE qhelp PUBLIC
2+
"-//Semmle//qhelp//EN"
3+
"qhelp.dtd">
4+
<qhelp>
5+
6+
<overview>
7+
<p>...</p>
8+
</overview>
9+
10+
<recommendation>
11+
<p>...</p>
12+
</recommendation>
13+
14+
<example>
15+
<sample src="CommaBeforeMisleadingIndentation.cpp" />
16+
</example>
17+
18+
</qhelp>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
select 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| 1 |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Best Practices/Likely Errors/CommaBeforeMisleadingIndentation.ql
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
void test(int i, int j, int (*foo)(int))
3+
{
4+
if (i)
5+
(void)i, // GOOD
6+
(void)j;
7+
8+
if (i)
9+
(void)i, // BAD
10+
(void)j;
11+
12+
foo((i++, j++)); // GOOD
13+
foo((i++, // GOOD
14+
j++));
15+
foo((i++
16+
, j++)); // GOOD
17+
foo((i++,
18+
j++)); // BAD (?)
19+
}

0 commit comments

Comments
 (0)