Skip to content

RFC v2: strip 15,000 lines from a typical autoconf.h

Paul Gortmaker linux-kbuild lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3kconfig: fix IS_ENABLED to not require all options to be definedinclude/linux/kconfig.h+18 -41 reply
2/3Revert "kconfig: fix __enabled_ macros definition for invisible and un-selected symbols"scripts/kconfig/confdata.c+13 -360 replies
3/3kconfig: delete last traces of __enabled_ from autoconf.hscripts/kconfig/confdata.c+0 -110 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] RFC v2: strip 15,000 lines from a typical autoconf.h
Quoted 8 lines · [Re: [PATCH 0/5] RFC: strip 15,000 lines from a typical autoconf.h] On…
Quoted 6 lines · Stephen Rothwell

Can we leave the CONFIG_ part in the caller, so they are still grepable, please?

So:

	#define config_enabled(x)	(__stringify(x)[0] == '1')
Quoted 8 lines

Sure. Except G+ came through, and we now have an even better hack for this, that works entirely in the preprocessor.

That also means that you can use it for static initializers etc, so you can do

   int some_value = config_enabled(CONFIG_ENABLE_XYZ_BY_DEFAULT);

Paul, do you want to write the patch to change IS_ENABLED() to use this trick?

Sure -- I've done this in patch #1 of the (now) three patches.

I've dropped all the patches relating to phasing out the users of IS_ENABLED within C code, since now they should just work.

Quoted 10 lines

Trick courtesy of "comex ." on G+ (please do give him credit even if he doesn't seem to use his real name):

  #define is_set(macro) is_set_(macro)
  #define macrotest_1 ,
  #define is_set_(value) is_set__(macrotest_##value)
  #define is_set__(comma) is_set___(comma 1, 0)
  #define is_set___(_, v, ...) v
Quoted 8 lines

and now "is_set(CONFIG_xyzzy)" works, and gives either 1 or 0 directly in the preprocessor.

Obviously the names have to be changed here (let's not use "macrotest_1" - make it something more internal), but the concept is solid, and I would actually suggest having this as a generic "is this macro set to 1" helper first, and then implement IS_ENABLED() in terms of that.

Hopefully the names I've chosen are OK. Please have a look.

Thanks,
Paul.

Quoted 4 lines

My likee.

Linus

Paul Gortmaker (3):
kconfig: fix IS_ENABLED to not require all options to be defined Revert "kconfig: fix __enabled_ macros definition for invisible and
un-selected symbols"
kconfig: delete last traces of __enabled_ from autoconf.h

 include/linux/kconfig.h    |   22 ++++++++++++++++++----
 scripts/kconfig/confdata.c |   38 ++------------------------------------
 2 files changed, 20 insertions(+), 40 deletions(-)
Signature · 1 line
1.7.9.1