Subject: Re: config(5) ifdef usage (was: CVS commit: src/usr.bin/config)
To: None <current-users@NetBSD.org>
From: Quentin Garnier <cube@cubidou.net>
List: current-users
Date: 11/10/2007 08:17:25
--hKnd/qOzIOdPs36Y
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Nov 10, 2007 at 07:54:05AM +0100, Bernd Ernesti wrote:
> Hi Quentin,
>=20
> On Fri, Nov 09, 2007 at 11:41:09PM +0000, Quentin Garnier wrote:
> >=20
> > Module Name:	src
> > Committed By:	cube
> > Date:		Fri Nov  9 23:41:09 UTC 2007
> >=20
> > Modified Files:
> > 	src/usr.bin/config: config.5 defs.h scan.l
> >=20
> > Log Message:
> > Add support for "ifdef <attribute>" blocks.  It goes like this:
> >=20
> > ifdef <attr> / ifndef <attr>
> > elifdef <attr>
> > elifndef <attr>
> > else
> > endif
>=20
> Hmm, can you give some example about how <attr> can be used right now?

It's not really meant for the end-user...  It will be used mostly in
files.*, e.g. for Xen to share more stuff with x86 in order to avoid
copy/pasting.

> The manpage mentions something about 'define' where I only see a few
> in e.g. files.i386.
> The other usage is about 'any other statement that implicitely defines
> attributes such as device' which I don't know how to use in this context.

"machine" now implicitely defines attributes, too.

The only potential use in the kernel option selection file (i.e.,
GENERIC as opposed to kernel option definition files such as
sys/conf/files) is if I ever come up with a config(1) flag that defines
the "debug" attribute so you could do e.g.:

ifdef debug
options DIAGNOSTIC
options DDB
endif

But that's far-streched.  Although you could also have a DEBUG config
that only does:

define debug
include arch/arch/conf/MYNORMALCONFIG

and MYNORMALCONFIG would contain the ifdef block above.

Actually that wouldn't work because you can't use define before machine.
Well, that could be arranged.  But really it wasn't the initial intent.

I tricked someone into reviewing config(5) in order to correct my bad
english and hopefully make it less obscure.  [hi bjs!]

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"See the look on my face from staying too long in one place
[...] every time the morning breaks I know I'm closer to falling"
KT Tunstall, Saving My Face, Drastic Fantastic, 2007.

--hKnd/qOzIOdPs36Y
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (NetBSD)

iQEVAwUBRzVbBdgoQloHrPnoAQLwMQf/c3KvfbKIEqtS4Je9CMFv/d031cbNf0dA
nr/DdPezcrdGUeRcWNZjH7jNJWzoohP+jCzKzJWNtPi0Vz+qKlpql+ig7XnaEnGH
fRmId/AX12xNGHLmaFgFk662aG4EiYo1pBHDFh+UKzO8q/dgiVdzOcCPWVFwk3Qq
gd5S3Juug8vzhnc5PLlDvwslNMS8dZhky4vG3IpwHnR1hE+gl63kYGqIYILH/1uK
tHIoDXsyvDmE0aKbnCDqA0WDju3h1hlrFTo1GBZUT8gHzfxDZRwRpq7y+7xTJis4
V9fuINzazqF9IOlr7UBmNK2EszcIEWDhTGIgpocF93w04TCTdThINQ==
=1Zvx
-----END PGP SIGNATURE-----

--hKnd/qOzIOdPs36Y--