[U-Boot] [PATCH v2] arm: Correct build error introduced by getenv_ulong() patch
Simon Glass
sjg at chromium.org
Wed Nov 9 15:11:49 CET 2011
Hi Wolfgang,
On Tue, Nov 8, 2011 at 2:49 PM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Simon Glass,
>
> In message <CAPnjgZ15f_gva5+MM1Em-L2sMxt1WAATxqiKUHOQAT893t9MMw at mail.gmail.com> you wrote:
>>
>> This discussion was regarding the need to #ifdef the variable declaration, viz:
>>
>> #if defined(THING1) || defined(THING2)
>> const char *cat;
>> #endif
>>
>> ...
>>
>>
>> #ifdef THING1
>> cat = getenv("cat");
>>
>> send_back(cat);
>> #endif
>>
>> ....
>>
>> #ifdef THING2
>> cat = check_outside("cat");
>>
>> if (cat)
>> wibble(cat);
>> #endif
>>
>>
>> and whether the top bit would be better as:
>>
>> __maybe_unused const char *cat;
>>
>> But more generally, lots of #ifdefs do make the code harder to read,
>> and potentially more brittle in the face of config changes.
>
> I would like to see only a minimal number of "__maybe_unused" in the
> code - in cases, where this is the way that hurts least.
>
> In the examples above, it might be better to use local blocks, like:
>
> #ifdef THING1
> {
> const char *cat = getenv("cat");
>
> send_back(cat);
> }
> #endif
>
Noted, thanks.
Regards,
Simon
>
> Best regards,
>
> 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
> "There is such a fine line between genius and stupidity."
> - David St. Hubbins, "Spinal Tap"
>
More information about the U-Boot
mailing list