Skip to content

Conversation

chris-eibl
Copy link
Member

@chris-eibl chris-eibl commented Oct 18, 2025

Since #137961 we're getting this warning

/home/runner/work/cpython/cpython/Tools/jit/trampoline.c:13:13: warning: 'visibility' attribute ignored [-Wignored-attributes]
   13 |     typedef DECLARE_TARGET((*jit_func));
      |             ^
/home/runner/work/cpython/cpython/Tools/jit/jit.h:11:49: note: expanded from macro 'DECLARE_TARGET'
   11 |     _Py_CODEUNIT *__attribute__((preserve_none, visibility("hidden"))) \
      |                                                 ^
1 warning generated.

for all platforms, e.g.
https://github.com/python/cpython/actions/runs/18575809544/job/52961278295?pr=140233
except i686-pc-windows-msvc, where this warning has to be suppressed

elif re.fullmatch(r"i686-pc-windows-msvc", host):
host = "i686-pc-windows-msvc"
condition = "defined(_M_IX86)"
# -Wno-ignored-attributes: __attribute__((preserve_none)) is not supported here.
args = ["-DPy_NO_ENABLE_SHARED", "-Wno-ignored-attributes"]

to silence the many warnings we'd get otherwise, because preserve_none is not supported there.

I suggest to use

// To use preserve_none in JIT builds, we need to declare a separate function
// pointer with __attribute__((preserve_none)), since this attribute may not be
// supported by the compiler used to build the rest of the interpreter.
typedef jit_func __attribute__((preserve_none)) jit_func_preserve_none;

I've verified with a small Godbolt demo and by comparing the emit_trampoline in the generated jit_stencils.h that the generated code remains the same.

@Fidget-Spinner
Copy link
Member

I think Savannah already opened a PR for this here #139981. Perhaps you could review it?

@chris-eibl
Copy link
Member Author

Thanks Ken. Well spotted, I haven't seen Savannah's PR so closing mine.

@chris-eibl chris-eibl closed this Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants