From 10d275fdf8bd55f438476ec5f08d55d2185b0042 Mon Sep 17 00:00:00 2001 From: Charlie Lin Date: Mon, 13 Apr 2026 09:05:34 -0400 Subject: [PATCH] gh-148483: Use Py_GCC_ATTRIBUTE(unused) for stop_tracing label (GH-148481) --- .gitignore | 1 + .../next/Build/2026-04-13-02-36-13.gh-issue-148483.gLe1h8.rst | 1 + Modules/_testinternalcapi/test_cases.c.h | 3 +++ Python/generated_cases.c.h | 3 +++ Tools/cases_generator/tier1_generator.py | 4 ++++ 5 files changed, 12 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2026-04-13-02-36-13.gh-issue-148483.gLe1h8.rst diff --git a/.gitignore b/.gitignore index f9d2cdfc32b..3bf5187d531 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.cover *.iml *.o +*.o.tmp *.lto *.a *.so diff --git a/Misc/NEWS.d/next/Build/2026-04-13-02-36-13.gh-issue-148483.gLe1h8.rst b/Misc/NEWS.d/next/Build/2026-04-13-02-36-13.gh-issue-148483.gLe1h8.rst new file mode 100644 index 00000000000..5b9b3069887 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-04-13-02-36-13.gh-issue-148483.gLe1h8.rst @@ -0,0 +1 @@ +Use ``Py_GCC_ATTRIBUTE(unused)`` for stop_tracing label. diff --git a/Modules/_testinternalcapi/test_cases.c.h b/Modules/_testinternalcapi/test_cases.c.h index 5ed7d7be41b..041adcff388 100644 --- a/Modules/_testinternalcapi/test_cases.c.h +++ b/Modules/_testinternalcapi/test_cases.c.h @@ -12943,6 +12943,9 @@ JUMP_TO_LABEL(error); DISPATCH(); } + #if _Py_TAIL_CALL_INTERP && !defined(_Py_TIER2) + Py_GCC_ATTRIBUTE((unused)) + #endif LABEL(stop_tracing) { #if _Py_TIER2 diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 6aa6fe445a2..ae01925077c 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -12940,6 +12940,9 @@ JUMP_TO_LABEL(error); DISPATCH(); } + #if _Py_TAIL_CALL_INTERP && !defined(_Py_TIER2) + Py_GCC_ATTRIBUTE((unused)) + #endif LABEL(stop_tracing) { #if _Py_TIER2 diff --git a/Tools/cases_generator/tier1_generator.py b/Tools/cases_generator/tier1_generator.py index 0334bec724d..d2fa749e141 100644 --- a/Tools/cases_generator/tier1_generator.py +++ b/Tools/cases_generator/tier1_generator.py @@ -203,6 +203,10 @@ def generate_tier1_labels( emitter.emit("\n") # Emit tail-callable labels as function defintions for name, label in analysis.labels.items(): + if name == 'stop_tracing': + emitter.emit("#if _Py_TAIL_CALL_INTERP && !defined(_Py_TIER2)\n") + emitter.emit("Py_GCC_ATTRIBUTE((unused))\n") + emitter.emit("#endif\n") emitter.emit(f"LABEL({name})\n") storage = Storage(Stack(), [], [], 0, False) if label.spilled: