-qasm

Category

Language element control

Pragma equivalent

None.

Purpose

Controls the interpretation of and subsequent generation of code for assembler language extensions.

When -qasm is in effect, the compiler generates code for assembly statements in the source code. Suboptions specify the syntax used to interpret the content of the assembly statement.

Note: The system assembler program must be available for this command to have effect.

Syntax

Read syntax diagramSkip visual syntax diagram
-qasm syntax — C

        .-asm--+------------+-.   
        |      |    .-gcc-. | |   
        |      '-=--+-----+-' |   
>>- -q--+-noasm---------------+--------------------------------><

Read syntax diagramSkip visual syntax diagram
-qasm syntax — C++

        .-asm--+---------------+-.   
        |      |    .-gcc----. | |   
        |      '-=--+-stdcpp-+-' |   
>>- -q--+-noasm------------------+-----------------------------><

Defaults

-qasm=gcc

Parameters

gcc
Instructs the compiler to recognize the extended GCC syntax and semantics for assembly statements.
C++ only stdcpp
Reserved for possible future use.

Specifying -qasm without a suboption is equivalent to specifying the default.

Usage

C only The token asm is not a C language keyword. Therefore, at language levels stdc89 and stdc99, which enforce strict compliance to the C89 and C99 standards, respectively, the option -qkeyword=asm must also be specified to compile source that generates assembly code. At all other language levels, the token asm is treated as a keyword unless the option -qnokeyword=asm is in effect. In C, the compiler-specific variants __asm and __asm__ are keywords at all language levels and cannot be disabled.

C++ only The tokens asm, __asm, and __asm__ are keywords at all language levels. Suboptions of -qnokeyword=token can be used to disable each of these reserved words individually.

For detailed information on the syntax and semantics of inline asm statements, see Inline assembly statements .

Predefined macros

Examples

The following code snippet shows an example of the GCC conventions for asm syntax in inline statements:
int a, b, c;
int main() {
    asm("add %0, %1, %2" : "=r"(a) : "r"(b), "r"(c) );
}

Related information