From owner-freebsd-current Tue Jan 27 04:49:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA10774 for current-outgoing; Tue, 27 Jan 1998 04:49:05 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from shrimp.dataplex.net (shrimp.dataplex.net [208.2.87.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA10769 for ; Tue, 27 Jan 1998 04:49:03 -0800 (PST) (envelope-from rkw@dataplex.net) Received: from [208.2.87.4] (user4.dataplex.net [208.2.87.4]) by shrimp.dataplex.net (8.8.8/8.8.5) with ESMTP id GAA00775; Tue, 27 Jan 1998 06:48:51 -0600 (CST) X-Sender: rkw@mail.dataplex.net Message-Id: In-Reply-To: <199801271101.DAA25275@implode.root.com> References: Your message of "Tue, 27 Jan 1998 10:08:45 GMT." <199801271008.DAA04483@usr09.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 27 Jan 1998 06:44:25 -0600 To: dg@root.com From: Richard Wackerbarth Subject: Re: PATCH: if_de.c #ifdef based version encoding Cc: Terry Lambert , current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk In response to Terry Lambert, At 5:01 AM -0600 1/27/98, David Greenman wrote: >>The value of the manifest constant __FreeBSD__ is derived from the >>compiler tools and not from the kernel being built. >> >>In other words, the value of __FreeBSD__ comes from the version of the >>OS the tools were built on, not from the OS that's running or the one >>that is being targeted. >> >>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. [...] > 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. In a sense, you are both right. The code SHOULD contain #if tests to allow the unification of multiple branches into a single vendor file. At the same time, Terry is correct that the test is being derived from a bogus source. The only definition that should be derived from the compiler is that which relates to the compiler itself. For example, "Is this a 'C' compiler or a 'C++' compiler?" might be such a distinction. The OS Target should be defined in the SOURCE tree of the system. This is what .../include/machine and .../include/sys should define. Now, unless you are using the default case of compiling for "this OS on this machine", those values are NOT in /usr/include/sys/ but rather some $TARGET/include/sys/. Richard Wackerbarth