include::../description.adoc[]

== Noncompliant Code Example

----
void doSomething() {
  ;                                                       // Noncompliant - was used as a kind of TODO marker
}
----

== Compliant Solution

----
void doSomething() {
}
----

== Exceptions

In the case of empty expanded macro and in the case of 2 consecutive semi-colons when one of the two is part of a macro-definition then the issue is not raised.

Example:

----
#define A(x) x;
#define LOG(x)

void fun() {
  A(5);
  LOG(X);
}
----

== See

* MISRA C:2004, 14.3 - Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment provided that the first character following the null statement is a white-space character.
* MISRA {cpp}:2008, 6-2-3 - Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment, provided that the first character following the null statement is a white-space character.
* https://wiki.sei.cmu.edu/confluence/x/5dUxBQ[CERT, MSC12-C.] - Detect and remove code that has no effect or is never executed
* https://wiki.sei.cmu.edu/confluence/x/IDZGBQ[CERT, MSC51-J.] - Do not place a semicolon immediately following an if, for, or while condition
* https://wiki.sei.cmu.edu/confluence/x/WtYxBQ[CERT, EXP15-C.] - Do not place a semicolon on the same line as an if, for, or while statement

ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
