mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-07-27 22:37:46 +00:00
Pacify check_names.py
Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
@@ -10,6 +10,7 @@ See framework/docs/architecture/config-check-framework.md for information.
|
||||
import argparse
|
||||
import enum
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import textwrap
|
||||
import typing
|
||||
@@ -74,8 +75,6 @@ class Checker:
|
||||
|
||||
def user(self, _prefix: str) -> str:
|
||||
"""C code to inject immediately after including the user config."""
|
||||
#pylint: disable=no-self-use
|
||||
# Derived classes will add content where needed.
|
||||
return f'''
|
||||
#if defined({self.name})
|
||||
# error {self._quoted_message()}
|
||||
@@ -121,6 +120,13 @@ class Removed(Checker):
|
||||
"""
|
||||
return f'{self.name} was removed in {self.version}.'
|
||||
|
||||
def user(self, prefix: str) -> str:
|
||||
"""C code to inject immediately after including the user config."""
|
||||
code = super().user(prefix)
|
||||
return re.sub(rf'^ *# *\w+.*\b{self.name}\b.*$',
|
||||
lambda m: m.group(0) + ' //no-check-names',
|
||||
code, flags=re.M)
|
||||
|
||||
|
||||
class BranchData(typing.NamedTuple):
|
||||
"""The relevant aspects of the configuration on a branch."""
|
||||
@@ -172,7 +178,7 @@ class HeaderGenerator:
|
||||
/* {basename} (generated part of {self.branch_data.header_prefix}config.c). */
|
||||
/* Automatically generated by {os.path.basename(sys.argv[0])}. Do not edit! */
|
||||
|
||||
#if !defined({self.bypass_checks})
|
||||
#if !defined({self.bypass_checks}) //no-check-names
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
''')
|
||||
@@ -180,7 +186,7 @@ class HeaderGenerator:
|
||||
out.write(f'''
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#endif /* !defined({self.bypass_checks}) */
|
||||
#endif /* !defined({self.bypass_checks}) */ //no-check-names
|
||||
|
||||
/* End of automatically generated {basename} */
|
||||
''')
|
||||
|
||||
Reference in New Issue
Block a user