]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scripts/clang-tools: Convert clang-tidy args to list
authorGuru Das Srinagesh <quic_gurus@quicinc.com>
Tue, 11 Oct 2022 19:06:00 +0000 (12:06 -0700)
committerMasahiro Yamada <masahiroy@kernel.org>
Fri, 14 Oct 2022 13:32:52 +0000 (22:32 +0900)
Convert list of clang-tidy arguments to a list for ease of adding to
them and extending them as required.

Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/clang-tools/run-clang-tools.py

index bb78c9bde55c9420cebc46898b2e4962f890d0b8..56f2ec8f0f40a707df4265657664e4347bbf7bda 100755 (executable)
@@ -45,13 +45,14 @@ def init(l, a):
 
 def run_analysis(entry):
     # Disable all checks, then re-enable the ones we want
-    checks = "-checks=-*,"
+    checks = []
+    checks.append("-checks=-*")
     if args.type == "clang-tidy":
-        checks += "linuxkernel-*"
+        checks.append("linuxkernel-*")
     else:
-        checks += "clang-analyzer-*"
-        checks += ",-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling"
-    p = subprocess.run(["clang-tidy", "-p", args.path, checks, entry["file"]],
+        checks.append("clang-analyzer-*")
+        checks.append("-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling")
+    p = subprocess.run(["clang-tidy", "-p", args.path, ",".join(checks), entry["file"]],
                        stdout=subprocess.PIPE,
                        stderr=subprocess.STDOUT,
                        cwd=entry["directory"])