
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
49 lines
892 B
Plaintext
49 lines
892 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,cpp]
|
|
----
|
|
int function1()
|
|
{
|
|
return 3;
|
|
}
|
|
|
|
void function2()
|
|
{
|
|
function1();
|
|
}
|
|
|
|
int function3(char* ptr) /* Noncompliant; two explicit returns */
|
|
{
|
|
if (ptr == NULL) return -1;
|
|
|
|
return 7;
|
|
}
|
|
|
|
void function4(char *ptr) /* Noncompliant; two returns, one explicit and one implicit */
|
|
{
|
|
if (1) return;
|
|
|
|
printf("hello world!\n");
|
|
}
|
|
----
|
|
|
|
|
|
== Resources
|
|
|
|
* MISRA C:2004, 14.7 - A function shall have a single point of exit at the end of the function.
|
|
* MISRA {cpp}:2008, 6-6-5 - A function shall have a single point of exit at the end of the function
|
|
* MISRA C:2012, 15.5 - A function should have a single point of exit at the end
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|