[U-Boot] [PATCH v4 0/8] Provide a mechanism to avoid using #ifdef everywhere

Stefan Roese sr at denx.de
Wed Nov 6 09:30:53 CET 2013


Hi Wolfgang,

On 06.11.2013 08:24, Wolfgang Denk wrote:

<snip>

> 	if (autoconf_version_variable())
> 		setenv("ver", version_string);  /* set version variable */
> 
> By chance I ran about "include/linux/kconfig.h" in the Linux kernel
> tree, which provides (among other things) the IS_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 */
> 
> I agree that this does not solve some of the isses that have been
> raised about this change (indentation level increses - which may in
> turn require reformatting of bigger parts of the code; code becomes
> less readable), but on the other hand it avoids the need for a new
> autoconf header file, and it should be possible to introduce this
> easily step by step.
> 
> And I really like the idea of re-using existing code that is already
> known to Linux hackers, especially as we we are currently having our
> eyes on the Kconfig stuff anyway.

I just recently also noticed this IS_ENABLED() feature (in barebox btw)
and thought directly about Simon's patchset regarding this matter. And I
personally would favor IS_ENABLED() to the newly created autoconf_xxx names.

Thanks,
Stefan


More information about the U-Boot mailing list