From 345cd37abe324ad4f60f80e2c3133b8849e54e9b Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 22 Oct 2020 18:42:51 -0600 Subject: bpo-36876: Fix the C analyzer tool. (GH-22841) The original tool wasn't working right and it was simpler to create a new one, partially re-using some of the old code. At this point the tool runs properly on the master. (Try: ./python Tools/c-analyzer/c-analyzer.py analyze.) It take ~40 seconds on my machine to analyze the full CPython code base. Note that we'll need to iron out some OS-specific stuff (e.g. preprocessor). We're okay though since this tool isn't used yet in our workflow. We will also need to verify the analysis results in detail before activating the check in CI, though I'm pretty sure it's close. https://bugs.python.org/issue36876 --- Tools/c-analyzer/c_parser/parser/_alt.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Tools/c-analyzer/c_parser/parser/_alt.py (limited to 'Tools/c-analyzer/c_parser/parser/_alt.py') diff --git a/Tools/c-analyzer/c_parser/parser/_alt.py b/Tools/c-analyzer/c_parser/parser/_alt.py new file mode 100644 index 0000000000..05a9101b4f --- /dev/null +++ b/Tools/c-analyzer/c_parser/parser/_alt.py @@ -0,0 +1,6 @@ + +def _parse(srclines, anon_name): + text = ' '.join(l for _, l in srclines) + + from ._delim import parse + yield from parse(text, anon_name) -- cgit v1.2.1