kconfiglib: Update kconfiglib.py to always emit symbols

Emit all symbols (even ones disabled) to the autoconf.h header file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-11-18 21:06:16 -05:00
parent 0d5b05c704
commit 779b99c42b
1 changed files with 7 additions and 2 deletions

View File

@ -1475,8 +1475,8 @@ class Kconfig(object):
# instead, to avoid accessing the internal _write_to_conf variable # instead, to avoid accessing the internal _write_to_conf variable
# (though it's likely to keep working). # (though it's likely to keep working).
val = sym.str_value val = sym.str_value
if not sym._write_to_conf: #if not sym._write_to_conf:
continue # continue
if sym.orig_type in _BOOL_TRISTATE: if sym.orig_type in _BOOL_TRISTATE:
if val == "y": if val == "y":
@ -1485,6 +1485,9 @@ class Kconfig(object):
elif val == "m": elif val == "m":
add("#define {}{}_MODULE 1\n" add("#define {}{}_MODULE 1\n"
.format(self.config_prefix, sym.name)) .format(self.config_prefix, sym.name))
else:
add("#define {}{} 0\n"
.format(self.config_prefix, sym.name))
elif sym.orig_type is STRING: elif sym.orig_type is STRING:
add('#define {}{} "{}"\n' add('#define {}{} "{}"\n'
@ -1494,6 +1497,8 @@ class Kconfig(object):
if sym.orig_type is HEX and \ if sym.orig_type is HEX and \
not val.startswith(("0x", "0X")): not val.startswith(("0x", "0X")):
val = "0x" + val val = "0x" + val
if not val:
val = "0"
add("#define {}{} {}\n" add("#define {}{} {}\n"
.format(self.config_prefix, sym.name, val)) .format(self.config_prefix, sym.name, val))