[RFC PATCH 0/4] CONFIG_IS_ENABLED magic

Tom Rini trini at konsulko.com
Fri Jun 19 19:57:38 CEST 2020


On Fri, Jun 12, 2020 at 01:02:12PM +0200, Rasmus Villemoes wrote:

> The first patch is just something I suggested to allow zstd support to
> move forward. The remaining ones aim to make it more ergonomic to use
> CONFIG_IS_ENABLED to exclude things from the build.
> 
> While it currently works just fine in C code that one can do
> 
>   if (CONFIG_IS_ENABLED(FOO)) {
> 
>   }
> 
> and have the compiler throw the whole block away, and then later the
> linker throw away any functions and/or data that turns out not be used
> anyway, it's currently somewhat uglier to exclude items from an array
> initializer - it requires three lines to do
> 
>   #if CONFIG_IS_ENABLED(FOO)
>   { some array item },
>   #endif
> 
> and grepping for the FOO symbol doesn't really show what it is used
> for including/excluding.
> 
> With the last patch, one can instead do
> 
>   CONFIG_IS_ENABLED(FOO, ({ some array item },))
> 
> It's just an RFC; I think this can be useful to reduce the size of
> SPL/TPL without too much cluttering of the source, others can
> disagree.
> 
> 
> Rasmus Villemoes (4):
>   common/image.c: image_decomp: put IH_COMP_XXX cases inside ifndef
>     USE_HOSTCC
>   linux/kconfig.h: simplify logic for choosing CONFIG_{SPL_,TPL_,}*
>   linux/kconfig.h: remove unused helper macros
>   linux/kconfig.h: create two- and three-argument versions of
>     CONFIG_IS_ENABLED
> 
>  common/image.c               |   2 +
>  include/linux/kconfig.h      | 103 ++++++++++++++++++-----------------
>  scripts/config_whitelist.txt |   2 -
>  3 files changed, 54 insertions(+), 53 deletions(-)

This is I believe a good step forward and should let us clean up our
code in a few areas.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200619/2d3791db/attachment.sig>


More information about the U-Boot mailing list