]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-131278: Add option to build with computed gotos on Windows with clang-cl (GH-131279)
authorChris Eibl <138194463+chris-eibl@users.noreply.github.com>
Mon, 17 Mar 2025 20:32:23 +0000 (21:32 +0100)
committerGitHub <noreply@github.com>
Mon, 17 Mar 2025 20:32:23 +0000 (20:32 +0000)
Misc/NEWS.d/next/Build/2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst [new file with mode: 0644]
PCbuild/pythoncore.vcxproj
PCbuild/readme.txt

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 (file)
index 0000000..56e6983
--- /dev/null
@@ -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.
index 24d0afad0f6100b06163b4f581eb71d0c0cb2bd4..3a06d71d8aa6d8d86cdfb7202b575a2e1d5c6dff 100644 (file)
       <PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(UseTIER2)' != '' and '$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(UseTailCallInterp)' == 'true'">Py_TAIL_CALL_INTERP=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(WITH_COMPUTED_GOTOS)' != ''">HAVE_COMPUTED_GOTOS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <Link>
       <AdditionalDependencies>version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
index 33952d31681cbc04e8d8d4ca956f3ab2017806a4..8e82d4ea840fe194d65b21a3d5318a4a82b4ffc6 100644 (file)
@@ -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
 --------------