Subject: Re: is __NetBSD_Version__ being misused (again) ?
To: None <tech-kern@NetBSD.org>
From: Bernd Ernesti <firstname.lastname@example.org>
Date: 11/18/2007 08:51:06
On Sat, Nov 17, 2007 at 06:09:46PM -0800, Trevor Talbot wrote:
> On 11/17/07, Robert Elz <email@example.com> wrote:
> > | #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
> > | (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
> > |
> > | so __NetBSD_Prereq__(4,0,0) will succeed if __NetBSD_Version__ is
> > | 400000003.
> > /*
> > * #define __NetBSD_Version__ MMmmrrpp00
> > * (etc)
> > It isn't the test, the test is fine, the problem is with the definition
> > of __NetBSD_Version__ - and any problems with it won't appear until
> > NetBSD 4.0.1 is released. The problem is that __NetBSD_Prereq__() cannot
> > possibly distinguish between 4.0 (the way __NetBSD_Version__ for it
> > seems to be going to be defined) and 4.0.1.
> Er, why not? From what I can tell, 4.0.1 would be defined as
> 4000001xx. 4.0.0 is 4000000xx.
> __NetBSD_Prereq__() currently tests a minimum version, not a maximum
> one. A maximum test will look slightly different, but I don't see
> anything wrong with __NetBSD_Version__ itself.
Pavel mentioned that he couldn't find a usage of __NetBSD_Prereq__()
in the wild and thats where the problem starts, because __NetBSD_Version__
is normaly beeing used and you would expect that it is all zero for 4.0.0
when you want to check that you just run on 4.0.0 and not 400000003 or
40000000x where x > 0.
> It seems to me that if you want to lock code to a particular ABI, you
> need to test __NetBSD_Version__ equality anyway, not use
> Am I missing something?