From owner-freebsd-hackers Mon Aug 27 18:43:45 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smile.idiom.com (inreach-gw1.idiom.com [209.209.13.26]) by hub.freebsd.org (Postfix) with ESMTP id 59C2637B405 for ; Mon, 27 Aug 2001 18:43:41 -0700 (PDT) (envelope-from mda@discerning.com) Received: from mdaxke (adsl-63-196-0-240.dsl.snfc21.pacbell.net [63.196.0.240]) by smile.idiom.com (8.9.1/8.8.5) with SMTP id SAA77089; Mon, 27 Aug 2001 18:43:40 -0700 (PDT) Message-ID: <08e601c12f62$c48b79a0$6c456420@mdaxke> From: "Mark D. Anderson" To: Cc: "Charles Randall " Subject: Re: Portability of #warning in /usr/include Date: Mon, 27 Aug 2001 18:42:28 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > This may not work. >... > Some of those compilers > would NOT let you '#ifdef' out the version that it did not recognize > (perhaps thinking that '#warn' or '#warning' might be some gross typo > for '#else' or '#endif', I guess...). this is true; some compilers seem to require that #ifdef'd out code be syntactically correct. while #warning is not available in ISO C, #error is. it was deliberate to omit #warning; there is nothing in the standard to require #error to be fatal. one could easily argue that #warning would have been useful, even if the distinction between #warning and #error is hazy. i don't think pragmas offer a solution, in either the "#pragma warning" or "_Pragma" forms. i do not think gcc supports a "warning" pragma however (as in #pragma GCC warning foobar or _Pragma("GCC warning foobar")), nor is their such a thing in the STDC pragma namespace. one sure way to make things work is to move compiler-specific things to compiler-specific headers, which would probably be a good idea anyhow. something like including a "compiler_specific.h" which would in turn contain stuff like: #ifdef __GNUC__ #include "gnu_cruft.h" #elif __TenDRA__ /* don't know if this is what it is called */ #include "tendra_cruft.h" #else #error what compiler is this? #endif -mda To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message