This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Serious error-causing change in new CPP's -traditional behavior


On Wed, May 10, 2000 at 10:05:33AM -0700, Zack Weinberg wrote:

 > > '#' introduces an immediate constant in the assembler syntax; removing it 
 > > is bogus, and worse, there is no way to escape it that I can see, other 
 > > than by playing stupid games.
 > 
 > A marginally better stupid game:
 > 
 > #define IMMED(n) # ##n
 > #define foo() mov	r0, IMMED(5)

...in fact, a similar trick has been used in the m68k system call stubs of
the NetBSD C library for some time now:

#ifdef __STDC__
#define IMMEDIATE       #
#define SYSTRAP(x)      movl IMMEDIATE SYS_ ## x ## ,%d0; trap IMMEDIATE 0
#else
#define SYSTRAP(x)      movl #SYS_/**/x,%d0; trap #0
#endif

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]