C++: respond to doc comments

This commit is contained in:
Robert Marsh
2018-10-17 11:57:54 -07:00
parent 61f338449c
commit 17537bb88b
4 changed files with 13 additions and 13 deletions

View File

@@ -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>

View File

@@ -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()