From owner-freebsd-current Sat Mar 8 11:33:14 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5C84537B401 for ; Sat, 8 Mar 2003 11:33:13 -0800 (PST) Received: from smtp1.server.rpi.edu (smtp1.server.rpi.edu [128.113.2.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id D48C543FDD for ; Sat, 8 Mar 2003 11:33:11 -0800 (PST) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp1.server.rpi.edu (8.12.8/8.12.7) with ESMTP id h28JX8Bg003889; Sat, 8 Mar 2003 14:33:08 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20030308184834.GC543@dhcp01.pn.xcllnt.net> References: <20030308161943.GA54921@attbi.com> <200303081728.h28HSDWM039984@khavrinen.lcs.mit.edu> <20030308184834.GC543@dhcp01.pn.xcllnt.net> Date: Sat, 8 Mar 2003 14:33:06 -0500 To: Marcel Moolenaar , Garrett Wollman From: Garance A Drosihn Subject: Re: #warning must be protected by #if __GNUC__ in headers? Cc: Craig Rodrigues , freebsd-current@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.28 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 10:48 AM -0800 3/8/03, Marcel Moolenaar wrote: >On Sat, Mar 08, 2003 at 12:28:13PM -0500, Garrett Wollman wrote: >> > > `#if __GNUC__' wouldn't help matters; every preprocessor has to > > read and interpret every preprocessor directive (so that `#else' > > and `#endif' can be recognized). > >I don't think preprocessors should interpret directives when they >are dead (ie part of an #if block or #else block that is not to >be compiled). I tried to use this once, on a cross-platform program I wrote. I can tell you that some compilers will choke on a #warning, even if it is inside a #if/#endif. And other compilers will choke on #warn, even if *it* is in a #if/#endif. (note: some compilers which do not recognize #warning will support #warn for the same thing). By adding that #warning, you are going to have a compile-time error on some compilers, whether or not you want it. Hiding it inside of an #if/#endif will help for some compilers, but not on all of them. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message