Skip to content

Commit cbd81d5

Browse files
authored
GH-148047: Check early whether tail-calling is possible for MSVC builds on Windows (#148036)
Rather than failing late when compiling e.g. a debug configuration ``` build.bat -c debug --tail-call-interp ``` with hundreds of ``` error C4737: Unable to perform required tail call. Performance may be degraded. ``` -- fail early with an explicit error message for configurations that are not supported by MSVC. This is a follow-up on #140513 / #140548
1 parent 208195d commit cbd81d5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fail fast with an explicit and clear error message if tail-calling is not
2+
possible for MSVC builds on Windows. Patch by Chris Eibl.

PCbuild/pythoncore.vcxproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,4 +749,13 @@
749749
<Target Name="_DeletePyBuildDirTxt" BeforeTargets="PrepareForBuild">
750750
<Delete Files="$(OutDir)pybuilddir.txt" />
751751
</Target>
752+
753+
<Target Name="_CheckTailCalling" BeforeTargets="PrepareForBuild" Condition="'$(UseTailCallInterp)' == 'true' and $(PlatformToolset) != 'ClangCL'">
754+
<Error Text="MSVC supports tail-calling only for x64."
755+
Condition="$(Platform) != 'x64'" />
756+
<Error Text="Platform toolset >= v145 is required for tail-calling."
757+
Condition="$(PlatformToolset.Replace('v', '0')) &lt; '145'" />
758+
<Error Text="MSVC requires optimization to be enabled for tail-calling."
759+
Condition="$(Configuration) == 'Debug'" />
760+
</Target>
752761
</Project>

0 commit comments

Comments
 (0)