• Masahiro Yamada's avatar
    kconfig.h: allow to use IS_{ENABLE,REACHABLE} in macro expansion · 5e8754fd
    Masahiro Yamada authored
    The typical usage of IS_ENABLED() is
        if (IS_ENABLED(CONFIG_FOO)) {
    The current implementation of IS_ENABLED() includes "||" operator,
    which works well in those expressions like above.
    However, there is a case where we want to evaluate a config option
    beyond those use cases.
    For example, the OF_TABLE() in include/asm-generic/vmlinux.lds.h
    needs to evaluate a config option in macro expansion:
      #define ___OF_TABLE(cfg, name)  _OF_TABLE_##cfg(name)
      #define __OF_TABLE(cfg, name)   ___OF_TABLE(cfg, name)
      #define OF_TABLE(cfg, name)     __OF_TABLE(config_enabled(cfg), name)
      #define _OF_TABLE_0(name)
      #define _OF_TABLE_1(name)  \
    Here, we can not use IS_ENABLED() because of the "||" operator in
    its define.  It is true config_enabled() works well, but it is a bit
    ambiguous to be used against config options.
    This commit makes IS_ENABLED() available in more generic context by
    calculating "or" with macro expansion only.
    Do likewise for IS_REACHABLE().
    Signed-off-by: 's avatarMasahiro Yamada <yamada.masahiro@socionext.com>
    Signed-off-by: 's avatarMichal Marek <mmarek@suse.com>
kconfig.h 2.34 KB