From 912c75372ccd1fab272d0edf932d343e8d4589a2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 7 Jun 2019 19:57:47 +0800 Subject: [PATCH] confgen.py: don't output compatibility definitions for options which are not defined MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For example, if a renamed option CONFIG_NEW is a bool with value “n”, kconfiglib will not generate a define for it in the Kconfig file. The define (#define CONFIG_NEW 1) will only be generated if the option is “y” or “m”. However the compatibility definition was always generated: #define CONFIG_OLD CONFIG_NEW. This broke the #ifdef checks which depended on the old option names. This commit wraps each compatibility definition: #ifdef CONFIG_NEW #define CONFIG_OLD CONFIG_NEW #endif so that the CONFIG_OLD definition is only generated if CONFIG_NEW is defined. --- tools/kconfig_new/confgen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/kconfig_new/confgen.py b/tools/kconfig_new/confgen.py index 4ea0331772..bbd4e28042 100755 --- a/tools/kconfig_new/confgen.py +++ b/tools/kconfig_new/confgen.py @@ -167,7 +167,8 @@ class DeprecatedOptions(object): f_o.write('\n/* List of deprecated options */\n') for dep_opt in sorted(self.r_dic): new_opt = self.r_dic[dep_opt] - f_o.write('#define {}{} {}{}\n'.format(self.config_prefix, dep_opt, self.config_prefix, new_opt)) + f_o.write('#ifdef {}{}\n#define {}{} {}{}\n#endif\n\n'.format(self.config_prefix, new_opt, + self.config_prefix, dep_opt, self.config_prefix, new_opt)) def main():