[cfe-dev] Pre-processing assembly sources

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Thu Aug 11 05:52:12 PDT 2016


On Thu, Aug 11, 2016 at 09:16:17AM +0100, Martin J. O'Riordan wrote:
> Thanks Joerg.
> 
> I have another question about pre-processing for assembly sources.
> 
> C and C++ do not distinguish newline from any other kind of whitespace, and
> the expansion of a macro has no embedded newlines (keeps line tracking
> happy).
> 
> But assemblers typically process a line at a time, so a macro such as:
> 
>   #define LOAD_and_ADDI(n) \
>     LD  r1, r2 \
>     ADDI r1, r1, n
> 
>   LOAD_and_ADDI(0x20)
> 
> expands to:
> 
>   LD  r1, r2 ADDI r1, r1, 0x20

This is normally dealt with by separating the instructions explicitly
with ";".

Joerg


More information about the cfe-dev mailing list