Re: [PATCH] kconfig.h: remove config_enabled() macro

From: Paul Bolle
Date: Thu Oct 20 2016 - 08:45:52 EST


[Added Nicolas.]

On Thu, 2016-10-20 at 21:06 +0900, Masahiro Yamada wrote:
> 2016-10-20 19:04 GMT+09:00 Paul Bolle <pebolle@xxxxxxxxxx>:
> > On Sun, 2016-10-16 at 20:07 +0900, Masahiro Yamada wrote:
> > There are about a dozen instances of IS_ENABLED() that target something
> > other than a kconfig macros. Are you planning to convert those to
> > __is_defined() too?
>
> I did not notice that, but looks like there are some to be checked.

Are you willing to do that or should I give it a try (after this patch
has landed, of course)?

> > > --- a/include/linux/kconfig.h
> > > +++ b/include/linux/kconfig.h
> > > @@ -31,7 +31,6 @@
> > > Â * When CONFIG_BOOGER is not defined, we generate a (... 1, 0) pair, and when
> > > Â * the last step cherry picks the 2nd arg, we get a zero.
> > > Â */
> > > -#define config_enabled(cfg)ÂÂÂÂÂÂÂÂÂÂ___is_defined(cfg)
> >
> > Is there a reason to keep using the double underscore prefix?
>
> I followed the suggestion in the following message:
>
> https://lkml.org/lkml/2016/6/6/944

Nicolas: was there any specific reason to suggest __is_defined() and
not, say, is_defined()?

> > > Â#define __is_defined(x)ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ___is_defined(x)
> > > Â#define
> > > ___is_defined(val)ÂÂÂÂÂÂÂÂÂÂÂ____is_defined(__ARG_PLACEHOLDER_##v
> > > al)
> > > Â#define ____is_defined(arg1_or_junk)
> > > __take_second_arg(arg1_or_junk 1, 0)
> >
> > __is_defined() is now meant to be used generally, and not just on
> > kconfig macros. Can it be moved into another header?
>
> Currently, __is_defined() is only used in two places:
>
> include/linux/export.h
> include/asm-generic/export.h
>
> Even if we fix something like IS_ENABLED(DEBUG),
> we do not have many for now,
> but perhaps will it be used more widely in the future?
>
> If so, do we need to addÂÂIS_DEFINED() or is_defined()?

Either is fine with me. I'll gladly defer to anyone with good taste in
naming things.

> in include/linux/kconfig.h ?ÂÂor include/linux/kernel.h ?

kernel.h seems to be included just about anywhere and it contains
various preprocessor macros of general utility. So that looks like a
fine candidate. Would it be a problem to put it there?

Thanks,


Paul Bolle