The Wayback Machine - https://web.archive.org/web/20260616013553/https://github.com/python/cpython/pull/131584
Skip to content

GH-131296: fix clang-cl warning on Windows in pegen.h#131584

Merged
pablogsal merged 1 commit into
python:mainfrom
chris-eibl:fix_clangcl_pegen
Apr 15, 2025
Merged

GH-131296: fix clang-cl warning on Windows in pegen.h#131584
pablogsal merged 1 commit into
python:mainfrom
chris-eibl:fix_clangcl_pegen

Conversation

@chris-eibl

@chris-eibl chris-eibl commented Mar 22, 2025 •

Copy link
Copy Markdown
Member

Fix warning : fastcall calling convention is not supported on variadic function [-Wignored-attributes].
This warning is seen 7 times in a row: https://github.com/python/cpython/actions/runs/14006628024/job/39221297660#step:4:239

For 32bit builds of pythoncore, we'd see this another 7 times (and in case of PGO we'd triple up to 21 warnings).

MSVC seems to silently ignore it https://devblogs.microsoft.com/oldnewthing/20131128-00/?p=2543.

Comment thread Parser/pegen.h
void _Pypegen_stack_overflow(Parser *p);

Py_LOCAL_INLINE(void *)
static inline void *

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpython/Include/pyport.h

Lines 190 to 197 in 18249d9

#if defined(_MSC_VER)
/* ignore warnings if the compiler decides not to inline a function */
# pragma warning(disable: 4710)
/* fastest possible local call under MSVC */
# define Py_LOCAL(type) static type __fastcall
# define Py_LOCAL_INLINE(type) static __inline type __fastcall
#else
# define Py_LOCAL(type) static type

__fastcall is anyway only in effect for 32bit builds. The warning stems from the _freeze_module, which is by default compiled in 32bit mode (unless you override PreferredToolArchitecture). Let's simply convert to static inline.

@chris-eibl

Copy link
Copy Markdown
Member Author

I think this is a skip news?

@chris-eibl chris-eibl changed the title GH-131296: fix warning in pegen.h Mar 23, 2025

@vstinner vstinner left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I agree with @chris-eibl's rationale that __fastcall is useless on this function.

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks a lot for the fix @chris-eibl

@pablogsal pablogsal merged commit e94d168 into python:main Apr 15, 2025
@chris-eibl chris-eibl deleted the fix_clangcl_pegen branch April 15, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants