[parisc-linux] Gnu cpp bug or feature?

Matthew Wilcox matthew@wil.cx
Mon, 29 Jan 2001 21:17:31 +0000


On Wed, Jan 10, 2001 at 01:50:13PM +0000, Matthew Wilcox wrote:
> On Tue, Jan 09, 2001 at 11:31:49PM -0700, John Marvin wrote:
> > 
> > I just discovered that the gnu cpp doesn't allow * and = to be concatenated.
> > What I am trying to do is the following:
> 
> GNU cpp does do some slightly strange things to avoid accidentally creating
> C tokens.  However, you should be able to work around this behaviour by using
> the ## operator.  try...

ok, this problem is now fixed.  Our Makefiles have been broken for a
_long_ time, so -traditional was not being passed to cpp.  Now that it
is, it will no longer have this behaviour.

This has some downsides; some macro definitions no longer work the way
you expect them to if you've been brough up on ansi c, like i was.
in particular, multiline #defines no longer seem to work, and token
concatenation with ## no longer works.  Fix the former with #ifndef
__ASSEMBLY__ ... #endif around the macros which don't work and fix
the latter by replacing:

#define ENTRY_SAME(_name_) sys_ ## _name_

with

#define ENTRY_SAME(_name_) sys_/**/_name_

of course, this won't work with the cpp in ANSI mode, so if this is in
a header file, you'll need to #ifdef __ASSEMBLY__ #else #endif your
way around it.  fortunately the only example which needed it so far
was syscall.S, not a header file.

as far as I can tell, everything now seems to be working; i recommend only
fixing things as we run into problems with this.  John, do you want to
change back to the ADDIB= form now, leave it as it is, or have me do it?

> >     ADDIB>      -1,%r1,1b
> >     ADDIB=      -1,%arg3,fdoneloop

-- 
Revolutions do not require corporate support.