Interpretation of Dir 4.3 - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 7.4 Code design (https://forum.misra.org.uk/forumdisplay.php?fid=181) +---- Thread: Interpretation of Dir 4.3 (/showthread.php?tid=1307) |
Interpretation of Dir 4.3 - nakagawat - 23-01-2017 Hi All, Would you please advise me if a macro containing both assembly and C code is a violation of Dir 4.3? Example: #define M_def do { asm( "mv r0,r1" ); use_uint32( 0 ); } while( 0 ) Please note that 'use_uint32( 0 );' is a function call. Regards, Tad Re: Interpretation of Dir 4.3 - misra-c - 03-02-2017 Directive 4.3 states that the assembly language instruction shall "encapsulated and isolated". The meaning of the word "isolated" is that a macro containing assembly language instructions should contain only assembly instructions and no other C code. Therefore your code violates Dir 4.3. |