MISRA Discussion Forums
Clarification for 7-4-3 - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.7 Declarations (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=136)
+---- Thread: Clarification for 7-4-3 (/showthread.php?tid=1328)



Clarification for 7-4-3 - mikearmagedon - 28-03-2017

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();
  ...
}



Re: Clarification for 7-4-3 - misra cpp - 10-07-2017

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