[Bf-blender-cvs] [606271966e1] master: check_cppcheck: use '--cppcheck-build-dir'

Campbell Barton noreply at git.blender.org
Mon Oct 4 04:19:38 CEST 2021


Commit: 606271966e1344958d43f5660be1ae46d2637738
Author: Campbell Barton
Date:   Mon Oct 4 13:12:36 2021 +1100
Branches: master
https://developer.blender.org/rB606271966e1344958d43f5660be1ae46d2637738

check_cppcheck: use '--cppcheck-build-dir'

Use a temporary directory for faster performance.

===================================================================

M	build_files/cmake/cmake_static_check_cppcheck.py

===================================================================

diff --git a/build_files/cmake/cmake_static_check_cppcheck.py b/build_files/cmake/cmake_static_check_cppcheck.py
index 1eef2efe2b5..79b0e236ce5 100644
--- a/build_files/cmake/cmake_static_check_cppcheck.py
+++ b/build_files/cmake/cmake_static_check_cppcheck.py
@@ -24,6 +24,7 @@ import project_source_info
 import subprocess
 import sys
 import os
+import tempfile
 
 from typing import (
     Any,
@@ -47,13 +48,15 @@ CHECKER_ARGS = [
     "--max-configs=1",  # speeds up execution
     #  "--check-config", # when includes are missing
     "--enable=all",  # if you want sixty hundred pedantic suggestions
+
+    # NOTE: `--cppcheck-build-dir=<dir>` is added later as a temporary directory.
 ]
 
 if USE_QUIET:
     CHECKER_ARGS.append("--quiet")
 
 
-def main() -> None:
+def cppcheck() -> None:
     source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
     source_defines = project_source_info.build_defines_as_args()
 
@@ -90,5 +93,11 @@ def main() -> None:
     print("Finished!")
 
 
+def main() -> None:
+    with tempfile.TemporaryDirectory() as temp_dir:
+        CHECKER_ARGS.append("--cppcheck-build-dir=" + temp_dir)
+        cppcheck()
+
+
 if __name__ == "__main__":
     main()



More information about the Bf-blender-cvs mailing list