rspec/rules/S1029/cfamily/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

59 lines
1.1 KiB
Plaintext

== Why is this an issue?
Similar to uncalled functions, un-instantiated class and function templates are a potential source of noise and they may be symptomatic of a more serious problem such as missing paths.
Note: Even though a given class template may be instantiated many times, it is possible that some of its member functions are never instantiated.
=== Noncompliant code example
[source,cpp]
----
template < typename T >
class Sample
{
public:
void inst_mem ( ) { }
void uninst_mem ( ) { } // Noncompliant, never instantiated
};
Sample<int64_t> s;
s.inst_mem ( ); // Call to s.inst_mem instantiates the member.
// s.uninst_mem is not called within the program and is not instantiated.
----
=== Exceptions
This rule does not apply to libraries.
== Resources
* MISRA {cpp}:2008, 14-7-1
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
"xxx" is never instantiated. It should be removed or referenced at least once.
'''
== Comments And Links
(visible only on this page)
=== is related to: S1763
=== relates to: S901
=== relates to: S897
endif::env-github,rspecator-view[]