Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 07 Jun 1998 09:42:43 -0700
From:      Mike Smith <mike@smith.net.au>
To:        joelh@gnu.org
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Irritating cpp feature 
Message-ID:  <199806071642.JAA06549@antipodes.cdrom.com>
In-Reply-To: Your message of "Sun, 07 Jun 1998 11:40:15 CDT." <199806071640.LAA17751@detlev.UUCP> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > I'm coming across an irritating cpp feature trying to port a large body 
> > of foreign code; namely:
> > #if 0
> > This is pointless text with one of ' in it.
> > #endif
> > Despite the #if-fing out, the quote is still parsed.  Unfortunately, 
> > this conflicts with a substantial body of #if'd documentation, which 
> > contains (you guessed it) more comment delimiters.
> > The code obviously builds OK on other gcc-wielding platforms; is there 
> > something funny about our preprocessor?
> 
> According to ANSI C, anything in an #if / #endif must still be, up to
> a point, valid C syntax.  The fact that most preprocessors assume that
> all quotes are matched is irrelevant.  I hate to break it to you,
> Mike, but it's invalid code.  Now, that said, I'll look at fixing your
> problem.  :-)

This is the least of my quibbles with the quality of the code in 
question, but I don't have the time to get too carried away "fixing" 
a source tree that bulks over 500MB.

> Are you using the same version of gcc on said other gcc-wielding
> platforms?  I wouldn't be suprised if cpp has changed in the interim.

The code is known to build on current Linux systems.  The cpp barfage 
comes from 'cc -E', being invoked by a (their) custom prototype 
generator.  It sounds like I can just tweak the cpp invocation to 
suppress this (it may also deal with the '...' construct in similar 
circumstances causing problems).

> Depending on the code, it may be trivial to write a quick sed/awk/perl
> script to mung it into conformity.  (I wouldn't mind taking that on as
> an exercise myself if you're busy; I might have use for it elsewhere.)

If I were to do that, my chances of ever having the port enter their 
mainstream would be absolutely zero. 8(

-- 
\\  Sometimes you're ahead,       \\  Mike Smith
\\  sometimes you're behind.      \\  mike@smith.net.au
\\  The race is long, and in the  \\  msmith@freebsd.org
\\  end it's only with yourself.  \\  msmith@cdrom.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806071642.JAA06549>