From 468a7aaeb4dfcd21697dfa46362b9f415b9daf1b Mon Sep 17 00:00:00 2001 From: Chris Eibl <138194463+chris-eibl@users.noreply.github.com> Date: Mon, 17 Mar 2025 21:32:23 +0100 Subject: GH-131278: Add option to build with computed gotos on Windows with clang-cl (GH-131279) --- .../2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst | 2 ++ PCbuild/pythoncore.vcxproj | 1 + PCbuild/readme.txt | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst diff --git a/Misc/NEWS.d/next/Build/2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst b/Misc/NEWS.d/next/Build/2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst new file mode 100644 index 0000000..56e6983 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst @@ -0,0 +1,2 @@ +Add optimizing flag ``WITH_COMPUTED_GOTOS`` to Windows builds for when +using a compiler that supports it (currently clang-cl). Patch by Chris Eibl. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 24d0afa..3a06d71 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -107,6 +107,7 @@ _Py_JIT;%(PreprocessorDefinitions) _Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions) Py_TAIL_CALL_INTERP=1;%(PreprocessorDefinitions) + HAVE_COMPUTED_GOTOS;%(PreprocessorDefinitions) version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies) diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt index 33952d3..8e82d4e 100644 --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -310,6 +310,27 @@ See for more on this topic. +Optimization flags +------------------ + +You can set optimization flags either via + +* environment variables, for example: + + set WITH_COMPUTED_GOTOS=true + +* or pass them as parameters to `build.bat`, for example: + + build.bat "/p:WITH_COMPUTED_GOTOS=true" + +* or put them in `msbuild.rsp` in the `PCbuild` directory, one flag per line. + +Supported flags are: + +* WITH_COMPUTED_GOTOS: build the interpreter using "computed gotos". + Currently only supported by clang-cl. + + Static library -------------- -- cgit v0.12