Provide a mechanism to avoid using #ifdef everywhere
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest posting 3/30 of 8 patches 0 repliesNew
- v4 posting 2/30 of 8 patches 0 repliesSuperseded
- v4 posting 1/30 of 8 patches 0 repliesSuperseded
Earlier versions · 1
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v1 RFC | 1 patch | 0 replies | Superseded |
Patches in v4 posting 3/3 No applies recorded yet
None of the 8 patches the cover letter announces are in this archive.
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.
Cover letter [U-Boot] [PATCH v4 0/8] Provide a mechanism to avoid using #ifdef everywhere
Dear Simon,
Quoted 1 line · In message <CAPnjgZ3B4sZi_2h2Sw7oop932CcgOu8HO5E_fKmjcyv4wS+eZA@mail.gmail.com>…
...
Quoted 7 lines
Quoted 7 lines
By chance I ran about "
include/linux/kconfig.h" in the Linux kernel tree, which provides (among other things) theIS_ENABLED()macro that implements essentially the very same feature. Using this, the same code would be written as:if (
IS_ENABLED(CONFIG_VERSION_VARIABLE))
setenv("ver", version_string); /* set version variable */
...
Quoted 1 line
Fair enough, sounds reasonable. The relevant kernel code is quite unusual...
Indeed, this code is really a bit creepy...
Quoted 3 lines
Many of U-Boot's options are not just yes/no, so I'm not sure what will happen with those. Perhaps they just can't be used with this macro? Part of my intent was to allow any option to be used.
I see. Um... But then, I think the usage of the macro is somewhat dangerous anyway.
Quoted 18 lines
So for example you can do this:
struct {
Quoted 15 lines
const char *str;
u_intlen;
int retry;
const char *conf; /* Configuration value */
}
delaykey [] = {
{ str:getenv("bootdelaykey"), retry: 1,
conf:autoconf_autoboot_delay_str()},
{ str:getenv("bootdelaykey2"), retry: 1,
conf:autoconf_autoboot_delay_str2()},
{ str:getenv("bootstopkey"), retry: 0,
conf:autoconf_autoboot_stop_str()},
{ str:getenv("bootstopkey2"), retry: 0,
conf:autoconf_autoboot_stop_str2()},
};
Well, this is not exactly easy to read either.
Quoted 9 lines
or this:
/* don't retry auto boot? */
Quoted 3 lines
if (
autoconf_boot_retry_time()&&!delaykey[i].retry)
retry_time= -1;Note that
autoconf_boot_retry_time()will return 0 if the CONFIG is not defined, or if its value is 0.
I see what yo mean, but I'd rather clean up the code to avoid such ambiguities.
Quoted 3 lines
It seems to me we should provide the Linux feature in U-Boot as part of the
Kconfigstuff, and see where it takes us. Combined with a bit more rationalisation of things likemain.cit might be enough.
Sounds like a plan - but we don't have to wait; we can add the header file any time we ike, and start converting pieces of code that seem to deserve such treatment. And, probably even more interesting, we can request it to be used for any new code being added.
Quoted 2 lines
I like the simplicity and power of the autoconf feature, but I have similar reservations to others.
I understand you. Eventuyally ther eis no easy solution that satisfies all.
Best regards,
Wolfgang Denk
Signature · 6 lines
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 Dealing with failure is easy: work hard to improve. Success is also easy to handle: you've solved the wrong problem. Work hard to improve.