Skip to content

Provide a mechanism to avoid using #ifdef everywhere

Stefan Roese u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v4 Latest0 of 8 patches 0 repliesNew

Patches in v4 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.

Read the v4 thread

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

Hi Wolfgang,

On 06.11.2013 08:24, Wolfgang Denk wrote:

<snip>

Quoted 18 lines

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.

Quoted 3 lines

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