[U-Boot] [RFC PATCH] Provide a mechanism to avoid using #ifdef everywhere

Simon Glass sjg at chromium.org
Thu Feb 21 21:58:01 CET 2013


Hi Wolfgang,

On Tue, Feb 19, 2013 at 11:14 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Simon Glass,
>
> In message <CAPnjgZ2NvwAB0t4v=41BaVxqMaCgAU7XBTTbM1ZRT0fTA_40tA at mail.gmail.com> you wrote:
>>
>> > You are wrong.  This includes a number of functions, and macros, too,
>> > for example:
> ...
>> That's a very manageable and small series of patches I think if we
>> want to use either. I do like an obvious name, and we already have
>> CONFIG_...
>
> I think we really need to define a new, so far unused name space for
> these, and reserve it for such purpose.

What about:

autoconf_...(): value of CONFIG (or 0 if not defined)
autoconf_has_...(): 1 if the CONFIG is defined, 0 if not defined
(rarely needed I think)

This doesn't seem to be used currently.

>
>> Yes this will definitely increase the time. The current brute force
>> 'sed' of all headers isn't very efficient. How impossible would it be
>> to regenerate this only when someone adds a new CONFIG, and then check
>> it into the source?
>
> Doesn't work - assume you are hacking on your new code (without
> checking in) - and if runs haywire because the needed re-scan is not
> done...

You would get compile errors in this case. I'm not sure how we can
optimise this then.

>
>> > Does not the already existing "include/autoconf.mk" contain this
>> > information?  In any case, please check "tools/scripts/define2mk.sed"
>>
>> It only has a list of CONFIG variables that are enabled for the board.
>> The C code will then get compile errors if it uses a config that is
>> not enabled. So we need to define all the others to be 0 so that the
>> code still compiles.
>
> I see.
>
> Thanks.
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> The human race is faced with a cruel choice: work  or  daytime  tele-
> vision.

Regards,
Simon


More information about the U-Boot mailing list