From owner-freebsd-bugs@FreeBSD.ORG Sun Aug 31 00:40:17 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0DA3216A4BF for ; Sun, 31 Aug 2003 00:40:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 23A7E43FF7 for ; Sun, 31 Aug 2003 00:40:16 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h7V7eFUp014814 for ; Sun, 31 Aug 2003 00:40:15 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h7V7eFnh014813; Sun, 31 Aug 2003 00:40:15 -0700 (PDT) Date: Sun, 31 Aug 2003 00:40:15 -0700 (PDT) Message-Id: <200308310740.h7V7eFnh014813@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bruce Evans Subject: Re: misc/56206: src/sys/sys/cdefs.h uses PreProcessor variablesthat aren't defined, causing noisy warnings. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Bruce Evans List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 Aug 2003 07:40:17 -0000 The following reply was made to PR misc/56206; it has been noted by GNATS. From: Bruce Evans To: Garrett Wollman Cc: freebsd-gnats-submit@freebsd.org Subject: Re: misc/56206: src/sys/sys/cdefs.h uses PreProcessor variables that aren't defined, causing noisy warnings. Date: Sun, 31 Aug 2003 17:33:09 +1000 (EST) On Sat, 30 Aug 2003, Garrett Wollman wrote: > < said: > > > The following patch shuts it up, and is functionally equivalent. > > Actually, the patch is not functionally equivalent: > > > -#if __STDC_VERSION__ < 199901 > > +#if defined(__STDC_VERSION__) && __STDC_VERSION__ < 199901 > > 0 < 199901 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 would be functionally equivalent, but is intentionally not used because it is harder to read. The feature of undefined identifiers being 0 in cpp expressions is used a lot in FreeBSD headers. E.g., in : #if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 When __GNUC__ is not defined, it evaluates as 0 so this expression is true (0 < 2). There is no warning about this from gcc because gcc always defines __GNUC__, at least in the broken versions that warn about this. Compilers that aren't gcc shouldn't define __GNUC__ or have the bug. The bug may be in FreeBSD's version of gcc. gcc normally suppresses warnings in "system" headers but FreeBSD turns this off since it wants to check for errors in system headers and at least old versions of gcc don't understand which headers are system ones anyway (for buildworld, the system headers aren't under /usr/include). Bruce