tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Avoiding traditional CPP for assembler

On Fri, Jan 07, 2011 at 10:12:57PM +0000, David Laight wrote:
> On Fri, Jan 07, 2011 at 10:51:46PM +0100, Joerg Sonnenberger wrote:
> > > 
> > > We could also __CONCAT(,) and __STRING()... but I guess that's ugly.
> > 
> > No, we can't. Nesting macros doesn't work. That's what I was looking at
> > first, but e.g. the interrupt vectors in x86 are created by macros and
> > that plays havoc with __CONCAT. It's the reason why so much stuff in
> > machine/asm.h is duplicated for __STDC__ and !__STDC__.
> It should work, sometimes you need an extra 'relay' #define in order
> to get the substitutions to happen in the right order.

OK, so with some double nested concat, it can be done. But do we really
want to go with that? There is IMO very little to be gained from using a
traditional CPP and the "modern" C90 rules for the preprocessor are a
lot nicer -- like being able to use spaces in macro arguments.

There is some fun involved with platforms that currently use # for line
comment or for constants. At least the former is not a problem that
can't be sed'ed and the latter would be something to investigate.


Home | Main Index | Thread Index | Old Index