mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-90110: Fix the c-analyzer Tool (gh-96731)
This includes: * update the whitelists * fixes so we can stop ignoring some of the files * ensure Include/cpython/*.h get analyzed
This commit is contained in:
parent
662782e95f
commit
1756ffd66a
10 changed files with 499 additions and 118 deletions
|
@ -44,7 +44,7 @@ def run_cmd(argv, *,
|
|||
return proc.stdout
|
||||
|
||||
|
||||
def preprocess(tool, filename, **kwargs):
|
||||
def preprocess(tool, filename, cwd=None, **kwargs):
|
||||
argv = _build_argv(tool, filename, **kwargs)
|
||||
logger.debug(' '.join(shlex.quote(v) for v in argv))
|
||||
|
||||
|
@ -59,19 +59,24 @@ def preprocess(tool, filename, **kwargs):
|
|||
# distutil compiler object's preprocess() method, since that
|
||||
# one writes to stdout/stderr and it's simpler to do it directly
|
||||
# through subprocess.
|
||||
return run_cmd(argv)
|
||||
return run_cmd(argv, cwd=cwd)
|
||||
|
||||
|
||||
def _build_argv(
|
||||
tool,
|
||||
filename,
|
||||
incldirs=None,
|
||||
includes=None,
|
||||
macros=None,
|
||||
preargs=None,
|
||||
postargs=None,
|
||||
executable=None,
|
||||
compiler=None,
|
||||
):
|
||||
if includes:
|
||||
includes = tuple(f'-include{i}' for i in includes)
|
||||
postargs = (includes + postargs) if postargs else includes
|
||||
|
||||
compiler = distutils.ccompiler.new_compiler(
|
||||
compiler=compiler or tool,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue