https://github.com/python/cpython/commit/468a7aaeb4dfcd21697dfa46362b9f415b9daf1b
commit: 468a7aaeb4dfcd21697dfa46362b9f415b9daf1b
branch: main
author: Chris Eibl <138194463+chris-e...@users.noreply.github.com>
committer: zooba <steve.do...@microsoft.com>
date: 2025-03-17T20:32:23Z
summary:

GH-131278: Add option to build with computed gotos on Windows with clang-cl 
(GH-131279)

files:
A Misc/NEWS.d/next/Build/2025-03-15-12-32-56.gh-issue-131278.1nd0mJ.rst
M PCbuild/pythoncore.vcxproj
M 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
index 00000000000000..56e698383aa1ef
--- /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 24d0afad0f6100..3a06d71d8aa6d8 100644
--- a/PCbuild/pythoncore.vcxproj
+++ b/PCbuild/pythoncore.vcxproj
@@ -107,6 +107,7 @@
       <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>
diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt
index 33952d31681cbc..8e82d4ea840fe1 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
 --------------
 

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to