MISRA Discussion Forums

Full Version: Clarification for 7-4-3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Rule 7-4-3 states that "... assembly instructions shall be encapsulated and isolated in either assembler functions or C++ functions.".

Does assembler functions refers to assembly directives (.func and .endfunc) used in a .S file or it refers to C++ functions that encapsulate the assembly instructions?

Is the example compliant?
asm.S
Code:
.global foo
.func foo
foo:
...
.endfunc
main.cpp
Code:
extern "C" {
  void foo();
}

int main(void) {
  ...
  foo();
  ...
}
Your code example is compliant, as the assembler code is not regarded as part of the C program. The rule relates to inline assembly code