From owner-freebsd-hackers Sun Jun 7 09:40:39 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA27234 for freebsd-hackers-outgoing; Sun, 7 Jun 1998 09:40:39 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mail.camalott.com (root@[208.203.140.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA27221 for ; Sun, 7 Jun 1998 09:40:26 -0700 (PDT) (envelope-from joelh@gnu.org) Received: from detlev.UUCP (tex-109.camalott.com [208.229.74.109] (may be forged)) by mail.camalott.com (8.8.7/8.8.5) with ESMTP id LAA25450; Sun, 7 Jun 1998 11:39:23 -0500 Received: (from joelh@localhost) by detlev.UUCP (8.8.8/8.8.8) id LAA17751; Sun, 7 Jun 1998 11:40:15 -0500 (CDT) (envelope-from joelh) Date: Sun, 7 Jun 1998 11:40:15 -0500 (CDT) Message-Id: <199806071640.LAA17751@detlev.UUCP> To: mike@smith.net.au CC: hackers@FreeBSD.ORG In-reply-to: <199806070753.AAA04355@antipodes.cdrom.com> (message from Mike Smith on Sun, 07 Jun 1998 00:53:48 -0700) Subject: Re: Irritating cpp feature From: Joel Ray Holveck Reply-to: joelh@gnu.org References: <199806070753.AAA04355@antipodes.cdrom.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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