Skip to content

Commit 896acf8

Browse files
committed
Supress unused variable warnings in generated executor_cases header
1 parent a32158f commit 896acf8

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Python/executor_cases.c.h

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/stack.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,12 @@ def __init__(self, check_stack_bounds: bool = False) -> None:
223223
self.variables: list[Local] = []
224224
self.check_stack_bounds = check_stack_bounds
225225

226-
def push_cache(self, cached_items:list[str], out: CWriter) -> None:
226+
def push_cache(self, op_name: str, cached_items:list[str], outputs: int, out: CWriter) -> None:
227227
for i, name in enumerate(cached_items):
228228
out.start_line()
229+
if (op_name == "_CALL_TYPE_1" and outputs == 2) \
230+
or (op_name == "_SHUFFLE_3_LOAD_CONST_INLINE_BORROW" and outputs == 3):
231+
out.emit("Py_GCC_ATTRIBUTE((unused))\n")
229232
out.emit(f"_PyStackRef _stack_item_{i} = {name};\n")
230233
self.push(Local.register(f"_stack_item_{i}"))
231234

Tools/cases_generator/tier2_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def generate_tier2(
282282
out.emit("assert(WITHIN_STACK_BOUNDS_IGNORING_CACHE());\n")
283283
declare_variables(uop, out)
284284
stack = Stack()
285-
stack.push_cache([f"_tos_cache{i}" for i in range(inputs)], out)
285+
stack.push_cache(uop.name, [f"_tos_cache{i}" for i in range(inputs)], outputs, out)
286286
stack._print(out)
287287
reachable, stack = write_uop(uop, emitter, stack, outputs)
288288
out.start_line()

0 commit comments

Comments
 (0)