Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 21 Dec 2001 00:11:13 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Ruslan Ermilov <ru@FreeBSD.org>
Cc:        Joerg Wunsch <joerg@FreeBSD.org>, <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/isa fd.c
Message-ID:  <20011220235518.V673-100000@gamplex.bde.org>
In-Reply-To: <20011219095119.B93645@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <machine/param.h>
> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011220235518.V673-100000>