Subject: Re: More on the #define spaghetti
To: Richard.Earnshaw@arm.com, Richard Earnshaw <rearnsha@arm.com>
From: Chris Gilbert <chris@paradox.demon.co.uk>
List: port-arm
Date: 06/11/2001 11:11:02
On Friday 08 June 2001 4:29 pm, Richard Earnshaw wrote:
> I've been thinking further about the current defopt mess, where every
> platform we build has to defopt several things even though it will never
> make use of them, simply because some source file it needs to build
> includes opt_<foo> for some reason.
>
> An idea for one way to solve some of this mess is for the basic hardware
> options that an ARM platform needs to support to be defopt-ed in a single
> header file, eg opt_hwconf.h, we could then use this for footbridge, ofw
> vidc iomd etc (ie the basic hw build options for an ARM) and save the need
> to include large numbers of opt_foo files at the top of a file. The
> defopt for each of the supported hw configurations would then just live in
> arm/conf/files.arm
I have to say this sounds great (having just had someone point out that cats
GENERIC doesn't build because I removed the defopt NETWINDER line which
locore.S needs *sigh* (and I didn't use a clean build dir to do a build, so
I've got lots of clutter in it))
> Thinking further on this, we could even use this principal to enable us to
> have a single consinit() function in a single source file in the same sort
> of way that i386 has. The code would then look something like
>
> #include "opt_hwconfig.h"
>
> void
> consinit ()
> {
> /* Glue to allow switching console at boot time */
> #ifdef COM_CONSOLE
> /* com-console code */
> #endif
> #ifdef VIDC
> /* vidc console init code */
> #endif
> #ifdef FOOTBRIDGE
> /* Footbridge console init code */
> #endif
> ...
> }
>
> Comments?
sounds good, although part of me is inclined to say that we should put inside
each of those blocks a call to other the relevant init function, which are
only there when that define is available. But that's just semantics :)
Cheers,
Chris