Assembly encapsulation in macros?

6.2 Language Extensions

Moderators: misra-c, david ward

Posts: 87
Joined: Thu Nov 18, 2004 1:39 am

Assembly encapsulation in macros?

Postby gs » Mon Apr 26, 2010 7:41 pm

Is this code compliant with rule #2.1?

Code: Select all

#define ASM_MACRO_1 asm { "abc" }
#define ASM_MACRO_2 asm { "xyz" }

extern void g();

void f( void )
    ASM_MACRO_1;    /* Do something in assembly.    */
    g();            /* Do something in C.           */
    ASM_MACRO_2;    /* Do something in assembly.    */

Posts: 547
Joined: Thu Jan 05, 2006 1:11 pm

Re: Assembly encapsulation in macros?

Postby misra-c » Thu May 13, 2010 9:04 am

The MISRA C Working Group considers this code to be compliant with Rule 2.1.

However, both this code and the example given in Rule 2.1 are not compliant with Rule 19.4 because the macro body is not of the permitted form.

A Technical Corrigendum is being considered to permit this form of macro under 19.4. The MISRA C Working Group considers the code as presented to be acceptable.
Posted by and on behalf of
the MISRA C Working Group

Return to “6.2 Language Extensions”

Who is online

Users browsing this forum: No registered users and 1 guest