rspec/rules/S997/compliant.adoc

41 lines
863 B
Plaintext
Raw Normal View History

=== Compliant solution
2020-06-30 12:50:59 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:50:59 +02:00
----
namespace MY_API { // Compliant
int a;
int b = 1;
extern int c = 1;
extern const int d = 1;
void f();
2020-06-30 12:50:59 +02:00
class A {
};
} // namespace MY_API
namespace { // Compliant, anonymous namespace
int a = 1;
void m2() {
}
}
int main() { // Compliant, exception for main
}
static int a; // Compliant, internal linkage
static void m1(); // Compliant, internal linkage
const int a = 1; // Compliant, a global constant is implicitly static
extern "C" int a = 1; // Compliant
extern "C" void f1(); // Compliant
void f2() {} // Compliant
2020-06-30 12:50:59 +02:00
typedef int a; // Compliant, we don't detect aliases
void *operator new(size_t bytes, const X::Y& context) { return X::malloc(bytes,context); } // Compliant by exception
void operator delete(void* ptr, const X::Y& context) { X::free(bytes,context); } // Compliant by exception
----