mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
C++: respond to doc comments
This commit is contained in:
@@ -6,15 +6,15 @@
|
||||
|
||||
<overview>
|
||||
<p>
|
||||
Code following a goto or break statement will not be executed, unless there is a label or switch
|
||||
case. When the code is necessary, this leads to logical errors or resource leaks. If the code is
|
||||
unnecessary, it may confuse readers.
|
||||
Code immediately following a <code>goto</code> or <code>break</code> statement will not be executed,
|
||||
unless there is a label or switch case. When the code is necessary, this leads to logical errors or
|
||||
resource leaks. If the code is unnecessary, it may confuse readers.
|
||||
</p>
|
||||
</overview>
|
||||
<recommendation>
|
||||
<p>
|
||||
If the unreachable code is necessary, move the goto or break statement to after the code.
|
||||
Otherwise, delete the unreachable code.
|
||||
If the unreachable code is necessary, move the <code>goto</code> or <code>break</code> statement to
|
||||
after the code. Otherwise, delete the unreachable code.
|
||||
</p>
|
||||
|
||||
</recommendation>
|
||||
@@ -22,7 +22,7 @@ Otherwise, delete the unreachable code.
|
||||
</example>
|
||||
<references>
|
||||
<li>
|
||||
The CERT C Secure Coding Standard: <a href="https://wiki.sei.cmu.edu/confluence/display/c/MSC12-C.+Detect+and+remove+code+that+has+no+effect+or+is+never+executed">MSC12-C. Detect and remove code that has no effect or is never executed</a>
|
||||
The CERT C Secure Coding Standard: <a href="https://wiki.sei.cmu.edu/confluence/display/c/MSC12-C.+Detect+and+remove+code+that+has+no+effect+or+is+never+executed">MSC12-C. Detect and remove code that has no effect or is never executed</a>.
|
||||
</li>
|
||||
</references>
|
||||
</qhelp>
|
||||
|
||||
@@ -29,4 +29,4 @@ where b.getStmt(i) = js
|
||||
and not s.(BreakStmt).getBreakable() instanceof SwitchStmt
|
||||
// the jump isn't a goto into the body of the next statement
|
||||
and not exists (LabelStmt ls | s.(Loop).getStmt().getAChild*() = ls | ls.getName() = js.(GotoStmt).getName())
|
||||
select js, "This statement makes $@ dead.", s, s.toString()
|
||||
select js, "This statement makes $@ unreachable.", s, s.toString()
|
||||
|
||||
Reference in New Issue
Block a user