Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2001 09:51:19 +0200
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Joerg Wunsch <joerg@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/isa fd.c
Message-ID:  <20011219095119.B93645@sunbay.com>
In-Reply-To: <200112182216.fBIMGX179954@freefall.freebsd.org>
References:  <200112182216.fBIMGX179954@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 18, 2001 at 02:16:33PM -0800, Joerg Wunsch wrote:
> joerg       2001/12/18 14:16:33 PST
> 
>   Modified files:
>     sys/isa              fd.c 
>   Log:
>   Change the test for _MACHINE_ARCH == i386 into #ifdef __i386__ since it
>   otherwise breaks on the Alpha arch.  I think this is wrong since i'd
>   actually like to probe for a PC architecture, not for a particular CPU
>   type.  Anyway, now it's again the way it used to be.
>   
>   Revision  Changes    Path
>   1.224     +8 -2      src/sys/isa/fd.c
> 
This is because _MACHINE_ARCH is a bogus define.

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.

Then, the #if _MACHINE_ARCH == i386 becomes #if 1 == 1.

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

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).)


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

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?20011219095119.B93645>