Subject: Re: is __NetBSD_Version__ being misused (again) ?
To: None <tech-kern@netbsd.org>
From: Pavel Cahyna <pavel@netbsd.org>
List: tech-kern
Date: 11/17/2007 12:03:14
On Sat, Sep 01, 2007 at 03:38:18AM +0700, Robert Elz wrote:
>     Date:        Fri, 31 Aug 2007 18:57:49 +0100
>     From:        Matthias Scheler <tron@zhadum.org.uk>
>     Message-ID:  <20070831175749.GA487@colwyn.zhadum.org.uk>
> 
>   | Probably 400000003,
> 
> In that case you (someone) really need to answer the part of the
> message about how the __NetBSD_Prereq__() macro is supposed to work.
> 
> If __NetBSD_Version is 400000003 then
> 	__NetBSD_Prereq__(4,0,0) fails
> 	__NetBSD_Prereq__(4,0,1) succeeds, but that says 4.0.1 is OK, and
> 			we cannot possibly know that yet.
> 
> The macro simply assumes that the last digits aren't ever going to be
> used.  Changing the macro would probably require another version bump...
> (as well as being needlessly disruptive).

As the release is approaching, it would be good to solve this problem if
there is any.

But I must admit I don't see it. __NetBSD_Prereq__ is defined as:

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

Also, given that there are probably exactly 0 uses of __NetBSD_Prereq__ in
the world (google code search reveals no uses outside the file where it is
defined) and that the test was wrong for a long time before anybody
noticed, I don't think issues with it are especially important.

Pavel