Interpretation of Dir 4.3

Moderators: misra-c, david ward

Post Reply
nakagawat
Posts: 5
Joined: Wed Sep 03, 2008 11:52 pm
Company: Toyo Corporation

Interpretation of Dir 4.3

Post by nakagawat » Mon Jan 23, 2017 6:45 am

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

misra-c
Posts: 555
Joined: Thu Jan 05, 2006 1:11 pm

Re: Interpretation of Dir 4.3

Post by misra-c » Fri Feb 03, 2017 3:39 pm

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.
---
Posted by and on behalf of
the MISRA C Working Group

Post Reply

Return to “7.4 Code design”