Miscellaneous-MissingInlineDefinition¶
Inline functions must be defined in every compilation unit where they are declared
Required inputs: IR
Bad code:
// foo.h
inline int foo(); // ERROR: Inline function is missing definition in compilation unit 'main.c'
// foo.c
#include "foo.h"
inline int foo() { return 42; }
void bar() {
int value = foo();
// ...
}
// main.c
#include "foo.h"
int main () {
return foo();
}
Good code (inline definition provided in header):
// foo.h
static inline int foo() { return 42; } // OK: Definition is provided in all translation units.
// foo.c
#include "foo.h"
void bar() {
int value = foo();
// ...
}
// main.c
#include "foo.h"
int main () {
return foo();
}
Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
missing_inline_def_in_multiple_units |
Inline function is missing definition in {} compilation units (e.g. ‘{}’) |
None |
False |
missing_inline_def_in_single_unit |
Inline function is missing definition in compilation unit ‘{}’ |
None |
False |
Options
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.