From patchwork Fri Jun 12 11:02:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 242164 List-Id: U-Boot discussion From: rasmus.villemoes at prevas.dk (Rasmus Villemoes) Date: Fri, 12 Jun 2020 13:02:12 +0200 Subject: [RFC PATCH 0/4] CONFIG_IS_ENABLED magic Message-ID: <20200612110216.10355-1-rasmus.villemoes@prevas.dk> 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(-)