MISRA Discussion Forums
Assembly encapsulation in macros? - 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: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17)
+---- Forum: 6.2 Language Extensions (https://forum.misra.org.uk/forumdisplay.php?fid=29)
+---- Thread: Assembly encapsulation in macros? (/showthread.php?tid=730)



Assembly encapsulation in macros? - gs - 26-04-2010

Is this code compliant with rule #2.1?
Code:
#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.    */
    }



Re: Assembly encapsulation in macros? - misra-c - 13-05-2010

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.