diff options
Diffstat (limited to 'scripts/config.py')
-rwxr-xr-x | scripts/config.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/config.py b/scripts/config.py index 22bdb5e..ef72db3 100755 --- a/scripts/config.py +++ b/scripts/config.py @@ -326,6 +326,7 @@ def crypto_adapter(adapter): DEPRECATED = frozenset([ 'MBEDTLS_SSL_PROTO_SSL3', + 'MBEDTLS_SSL_CLI_ALLOW_WEAK_CERTIFICATE_VERIFICATION_WITHOUT_HOSTNAME', 'MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO', ]) @@ -389,6 +390,7 @@ class ConfigFile(Config): self.default_path) super().__init__() self.filename = filename + self.inclusion_guard = None self.current_section = 'header' with open(filename, 'r', encoding='utf-8') as file: self.templates = [self._parse_line(line) for line in file] @@ -406,9 +408,11 @@ class ConfigFile(Config): r'(?P<arguments>(?:\((?:\w|\s|,)*\))?)' + r'(?P<separator>\s*)' + r'(?P<value>.*)') + _ifndef_line_regexp = r'#ifndef (?P<inclusion_guard>\w+)' _section_line_regexp = (r'\s*/?\*+\s*[\\@]name\s+SECTION:\s*' + r'(?P<section>.*)[ */]*') _config_line_regexp = re.compile(r'|'.join([_define_line_regexp, + _ifndef_line_regexp, _section_line_regexp])) def _parse_line(self, line): """Parse a line in config.h and return the corresponding template.""" @@ -419,10 +423,16 @@ class ConfigFile(Config): elif m.group('section'): self.current_section = m.group('section') return line + elif m.group('inclusion_guard') and self.inclusion_guard is None: + self.inclusion_guard = m.group('inclusion_guard') + return line else: active = not m.group('commented_out') name = m.group('name') value = m.group('value') + if name == self.inclusion_guard and value == '': + # The file double-inclusion guard is not an option. + return line template = (name, m.group('indentation'), m.group('define') + name + |