From owner-freebsd-current Tue Jan 27 17:27:16 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA04689 for current-outgoing; Tue, 27 Jan 1998 17:27:16 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from ren.dtir.qld.gov.au (firewall-user@ns.dtir.qld.gov.au [203.108.138.66]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA04466 for ; Tue, 27 Jan 1998 17:26:47 -0800 (PST) (envelope-from syssgm@dtir.qld.gov.au) Received: by ren.dtir.qld.gov.au; id LAA04832; Wed, 28 Jan 1998 11:46:51 +1000 (EST) Received: from ogre.dtir.qld.gov.au(167.123.8.3) by ren.dtir.qld.gov.au via smap (3.2) id xma004817; Wed, 28 Jan 98 11:46:35 +1000 Received: from localhost.dtir.qld.gov.au (localhost.dtir.qld.gov.au [127.0.0.1]) by ogre.dtir.qld.gov.au (8.8.7/8.8.7) with SMTP id LAA06212; Wed, 28 Jan 1998 11:24:08 +1000 (EST) Message-Id: <199801280124.LAA06212@ogre.dtir.qld.gov.au> X-Authentication-Warning: ogre.dtir.qld.gov.au: localhost.dtir.qld.gov.au [127.0.0.1] didn't use HELO protocol To: dg@root.com cc: freebsd-current@FreeBSD.ORG, syssgm@dtir.qld.gov.au Subject: Re: PATCH: if_de.c #ifdef based version encoding References: <199801271101.DAA25275@implode.root.com> <34CE4438.15FB7483@whistle.com> In-Reply-To: <34CE4438.15FB7483@whistle.com> from Julian Elischer at "Tue, 27 Jan 1998 20:31:52 +0000" Date: Wed, 28 Jan 1998 11:24:08 +1000 From: Stephen McKay Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk On Tuesday, 27th January 1998, Julian Elischer wrote: >David Greenman wrote: >> >> >This means that if I build a v3 kernel using a v2 system's tools, the >> >"#if __FreeBSD__ >= 3" and "#if defined(__FreeBSD__) && __FreeBSD__ >= 3" >> >will not test true, even though that is, in fact, what I am building. >> > >> >Version information should not be encoded in #ifdef's; that is what >> >branch tags are for. If I can check this code out, implicitly, I am >> >building a 3+ system. The "#if" tests are bogus. > >The problem occurs as I discovered yesterday when upgrading 2.2.x to 3.x >a very simple fix that would allow Matt to have his driver (mostly) >unmodified, would be: > >to check in, in the 3.0 branch, the following: > >#undef __FreeBSD__ >#define __FreeBSD__ 3 Or add (or get Matt to add) something like this at the top: #ifdef __FreeBSD__ #include #endif and put the appropriate #undef/#define pair in osversion.h. Then perhaps osversion.h and osreldate.h would be merged. A more extensive proposal would be to define individual symbols for each kernel interface change to allow fine control. Though this is likely too large a hammer for this particular nut it might be useful in the long run. >> In theory, the de driver is maintained by Matt Thomas and he supports >> multiple OS's and OS versions in the code. You'll notice that there are >> #ifdef's for NetBSD and BSD/OS in there as well. If we were going to do >> as you suggest, then it would only make sense if all of the OS #ifdef's >> were removed. This will only make it more difficult for Matt to support >> FreeBSD, so I think it's a bad idea. Making Matt's life difficult would be counterproductive, but these version tests are pretty silly from an ivory tower purist view, and are also a pain in practice. I'm with Terry on this one. Stephen.