Subject: Re: Making the (asm) world safe for modern cpp
To: None <tech-toolchain@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: tech-toolchain
Date: 09/17/2003 22:32:25
Jim Wise <jwise@draga.com> wrote:

> One of the main reasons for this behavior is that many of our assembly
> source files use a mix of `/**/'-style and `#'-style comments.  Where
> `#'-style comments appear on a line by themselves, modern cpp is
> confused, while `-traditional-cpp' is not as long as the `#' does not
> appear in the first character position on the line.
> 
> I therefore propose the following sequence of events to eliminate use of
> `-traditional-cpp' in our source tree:

Just a comment: assemblers that use `#' as part of the syntax (not as
a comment starter), e.g. SuperH, will have a problem with dropping
-traditional-cpp:

$ /usr/nb3/tools/bin/shle--netbsdelf-gcc-3.3.1 -E -
#define foo mov #0,r0
foo
#define bar(x) mov #0,x
bar(r0)
^D
# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "<stdin>"

<stdin>:3:21: '#' is not followed by a macro parameter
mov #0,r0

bar(r0)


Of course this can be worked around with something like

    #define IMM #
    #define bar(x) mov IMM 0, x 

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen