Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jun 1998 11:40:15 -0500 (CDT)
From:      Joel Ray Holveck <joelh@gnu.org>
To:        mike@smith.net.au
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Irritating cpp feature
Message-ID:  <199806071640.LAA17751@detlev.UUCP>
In-Reply-To: <199806070753.AAA04355@antipodes.cdrom.com> (message from Mike Smith on Sun, 07 Jun 1998 00:53:48 -0700)
References:   <199806070753.AAA04355@antipodes.cdrom.com>

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.  :-)

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.

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.)

Happy hacking,
joelh

-- 
Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped

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?199806071640.LAA17751>