From owner-cvs-all Thu Dec 20 5:11:29 2001 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id A360B37B419; Thu, 20 Dec 2001 05:11:17 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id AAA11564; Fri, 21 Dec 2001 00:11:14 +1100 Date: Fri, 21 Dec 2001 00:11:13 +1100 (EST) From: Bruce Evans X-X-Sender: To: Ruslan Ermilov Cc: Joerg Wunsch , , Subject: Re: cvs commit: src/sys/isa fd.c In-Reply-To: <20011219095119.B93645@sunbay.com> Message-ID: <20011220235518.V673-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 19 Dec 2001, Ruslan Ermilov wrote: > This is because _MACHINE_ARCH is a bogus define. True. It doesn't seem to be used for anything except to break netgraph/ng_vjc.c in the same way as fd.c (`#if _MACHINE_ARCH == almost_anything' is equivalent to `if 0 == 0'). Similarly for _MACHINE, except it it is not used to break netgraph/ng_vjc.c. > On i386's, ``cpp -dM /dev/null'' shows the following: > > [...] > #define i386 1 > [...] > > So, the ``#define _MACHINE_ARCH i386'' from > actually defines _MACHINE_ARCH as 1. Only in userland. The definition of i386 is namespace pollution which is disabled by compiling with "gcc -ansi". > Then, the #if _MACHINE_ARCH == i386 becomes #if 1 == 1. Actually, it becomes `#if 0 == 0' 8-8. > On alphas, ``cpp -dM /dev/null'' doesn't define "alpha" as 1, > so _MACHINE_ARCH is ``alpha'' (not a string constant!), and > i386 is not defined either, so > > #if _MACHINE == i386 becomes #if alpha == i386 becomes > #if 0 == 0 Both alpha and i386 are 0. > What you should be actually testing is MACHINE_ARCH, but > it's still not suitable in this case, because MACHINE_ARCH > is "i386" on PC98. Moreover, MACHINE is also "i386" on > PC98. (Don't obfuscate this with make(1)'s MACHINE variable, > which is set to "pc98" by config(8).) It's also a string, so it can't be used in cpp expression. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message