From 7f3b43a4c184ef91ba43ea702b9cea97cfa73345 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Tue, 30 Apr 2024 23:18:42 +0900 Subject: [PATCH] gh-118343: (void *) casting to avoid gcc-14 build failure issue --- Python/optimizer_cases.c.h | 152 +++++++++---------- Tools/cases_generator/optimizer_generator.py | 2 +- 2 files changed, 77 insertions(+), 77 deletions(-) diff --git a/Python/optimizer_cases.c.h b/Python/optimizer_cases.c.h index 0b696921ebfc9f..7ff0b5b2a1002a 100644 --- a/Python/optimizer_cases.c.h +++ b/Python/optimizer_cases.c.h @@ -81,7 +81,7 @@ case _END_SEND: { _Py_UopsSymbol *value; - value = sym_new_not_null(ctx); + value = (void *)sym_new_not_null(ctx); if (value == NULL) goto out_of_space; stack_pointer[-2] = value; stack_pointer += -1; @@ -90,7 +90,7 @@ case _UNARY_NEGATIVE: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-1] = res; break; @@ -98,7 +98,7 @@ case _UNARY_NOT: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-1] = res; break; @@ -206,7 +206,7 @@ case _REPLACE_WITH_TRUE: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-1] = res; break; @@ -214,7 +214,7 @@ case _UNARY_INVERT: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-1] = res; break; @@ -517,7 +517,7 @@ case _BINARY_SUBSCR: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -526,7 +526,7 @@ case _BINARY_SLICE: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-3] = res; stack_pointer += -2; @@ -540,7 +540,7 @@ case _BINARY_SUBSCR_LIST_INT: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -549,7 +549,7 @@ case _BINARY_SUBSCR_STR_INT: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -558,7 +558,7 @@ case _BINARY_SUBSCR_TUPLE_INT: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -567,7 +567,7 @@ case _BINARY_SUBSCR_DICT: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -608,7 +608,7 @@ case _CALL_INTRINSIC_1: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-1] = res; break; @@ -616,7 +616,7 @@ case _CALL_INTRINSIC_2: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -655,7 +655,7 @@ case _GET_AITER: { _Py_UopsSymbol *iter; - iter = sym_new_not_null(ctx); + iter = (void *)sym_new_not_null(ctx); if (iter == NULL) goto out_of_space; stack_pointer[-1] = iter; break; @@ -663,7 +663,7 @@ case _GET_ANEXT: { _Py_UopsSymbol *awaitable; - awaitable = sym_new_not_null(ctx); + awaitable = (void *)sym_new_not_null(ctx); if (awaitable == NULL) goto out_of_space; stack_pointer[0] = awaitable; stack_pointer += 1; @@ -672,7 +672,7 @@ case _GET_AWAITABLE: { _Py_UopsSymbol *iter; - iter = sym_new_not_null(ctx); + iter = (void *)sym_new_not_null(ctx); if (iter == NULL) goto out_of_space; stack_pointer[-1] = iter; break; @@ -698,7 +698,7 @@ case _LOAD_ASSERTION_ERROR: { _Py_UopsSymbol *value; - value = sym_new_not_null(ctx); + value = (void *)sym_new_not_null(ctx); if (value == NULL) goto out_of_space; stack_pointer[0] = value; stack_pointer += 1; @@ -707,7 +707,7 @@ case _LOAD_BUILD_CLASS: { _Py_UopsSymbol *bc; - bc = sym_new_not_null(ctx); + bc = (void *)sym_new_not_null(ctx); if (bc == NULL) goto out_of_space; stack_pointer[0] = bc; stack_pointer += 1; @@ -740,9 +740,9 @@ case _UNPACK_SEQUENCE_TWO_TUPLE: { _Py_UopsSymbol *val1; _Py_UopsSymbol *val0; - val1 = sym_new_not_null(ctx); + val1 = (void *)sym_new_not_null(ctx); if (val1 == NULL) goto out_of_space; - val0 = sym_new_not_null(ctx); + val0 = (void *)sym_new_not_null(ctx); if (val0 == NULL) goto out_of_space; stack_pointer[-1] = val1; stack_pointer[0] = val0; @@ -808,7 +808,7 @@ case _LOAD_LOCALS: { _Py_UopsSymbol *locals; - locals = sym_new_not_null(ctx); + locals = (void *)sym_new_not_null(ctx); if (locals == NULL) goto out_of_space; stack_pointer[0] = locals; stack_pointer += 1; @@ -817,7 +817,7 @@ case _LOAD_FROM_DICT_OR_GLOBALS: { _Py_UopsSymbol *v; - v = sym_new_not_null(ctx); + v = (void *)sym_new_not_null(ctx); if (v == NULL) goto out_of_space; stack_pointer[-1] = v; break; @@ -828,7 +828,7 @@ case _LOAD_GLOBAL: { _Py_UopsSymbol *res; _Py_UopsSymbol *null = NULL; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; null = sym_new_null(ctx); if (null == NULL) goto out_of_space; @@ -849,7 +849,7 @@ case _LOAD_GLOBAL_MODULE: { _Py_UopsSymbol *res; _Py_UopsSymbol *null = NULL; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; null = sym_new_null(ctx); if (null == NULL) goto out_of_space; @@ -862,7 +862,7 @@ case _LOAD_GLOBAL_BUILTINS: { _Py_UopsSymbol *res; _Py_UopsSymbol *null = NULL; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; null = sym_new_null(ctx); if (null == NULL) goto out_of_space; @@ -886,7 +886,7 @@ case _LOAD_FROM_DICT_OR_DEREF: { _Py_UopsSymbol *value; - value = sym_new_not_null(ctx); + value = (void *)sym_new_not_null(ctx); if (value == NULL) goto out_of_space; stack_pointer[-1] = value; break; @@ -894,7 +894,7 @@ case _LOAD_DEREF: { _Py_UopsSymbol *value; - value = sym_new_not_null(ctx); + value = (void *)sym_new_not_null(ctx); if (value == NULL) goto out_of_space; stack_pointer[0] = value; stack_pointer += 1; @@ -912,7 +912,7 @@ case _BUILD_STRING: { _Py_UopsSymbol *str; - str = sym_new_not_null(ctx); + str = (void *)sym_new_not_null(ctx); if (str == NULL) goto out_of_space; stack_pointer[-oparg] = str; stack_pointer += 1 - oparg; @@ -921,7 +921,7 @@ case _BUILD_TUPLE: { _Py_UopsSymbol *tup; - tup = sym_new_not_null(ctx); + tup = (void *)sym_new_not_null(ctx); if (tup == NULL) goto out_of_space; stack_pointer[-oparg] = tup; stack_pointer += 1 - oparg; @@ -930,7 +930,7 @@ case _BUILD_LIST: { _Py_UopsSymbol *list; - list = sym_new_not_null(ctx); + list = (void *)sym_new_not_null(ctx); if (list == NULL) goto out_of_space; stack_pointer[-oparg] = list; stack_pointer += 1 - oparg; @@ -951,7 +951,7 @@ case _BUILD_MAP: { _Py_UopsSymbol *map; - map = sym_new_not_null(ctx); + map = (void *)sym_new_not_null(ctx); if (map == NULL) goto out_of_space; stack_pointer[-oparg*2] = map; stack_pointer += 1 - oparg*2; @@ -964,7 +964,7 @@ case _BUILD_CONST_KEY_MAP: { _Py_UopsSymbol *map; - map = sym_new_not_null(ctx); + map = (void *)sym_new_not_null(ctx); if (map == NULL) goto out_of_space; stack_pointer[-1 - oparg] = map; stack_pointer += -oparg; @@ -990,7 +990,7 @@ case _LOAD_SUPER_ATTR_ATTR: { _Py_UopsSymbol *attr; - attr = sym_new_not_null(ctx); + attr = (void *)sym_new_not_null(ctx); if (attr == NULL) goto out_of_space; stack_pointer[-3] = attr; stack_pointer += -2; @@ -1000,9 +1000,9 @@ case _LOAD_SUPER_ATTR_METHOD: { _Py_UopsSymbol *attr; _Py_UopsSymbol *self_or_null; - attr = sym_new_not_null(ctx); + attr = (void *)sym_new_not_null(ctx); if (attr == NULL) goto out_of_space; - self_or_null = sym_new_not_null(ctx); + self_or_null = (void *)sym_new_not_null(ctx); if (self_or_null == NULL) goto out_of_space; stack_pointer[-3] = attr; stack_pointer[-2] = self_or_null; @@ -1265,7 +1265,7 @@ case _CONTAINS_OP_SET: { _Py_UopsSymbol *b; - b = sym_new_not_null(ctx); + b = (void *)sym_new_not_null(ctx); if (b == NULL) goto out_of_space; stack_pointer[-2] = b; stack_pointer += -1; @@ -1274,7 +1274,7 @@ case _CONTAINS_OP_DICT: { _Py_UopsSymbol *b; - b = sym_new_not_null(ctx); + b = (void *)sym_new_not_null(ctx); if (b == NULL) goto out_of_space; stack_pointer[-2] = b; stack_pointer += -1; @@ -1284,9 +1284,9 @@ case _CHECK_EG_MATCH: { _Py_UopsSymbol *rest; _Py_UopsSymbol *match; - rest = sym_new_not_null(ctx); + rest = (void *)sym_new_not_null(ctx); if (rest == NULL) goto out_of_space; - match = sym_new_not_null(ctx); + match = (void *)sym_new_not_null(ctx); if (match == NULL) goto out_of_space; stack_pointer[-2] = rest; stack_pointer[-1] = match; @@ -1295,7 +1295,7 @@ case _CHECK_EXC_MATCH: { _Py_UopsSymbol *b; - b = sym_new_not_null(ctx); + b = (void *)sym_new_not_null(ctx); if (b == NULL) goto out_of_space; stack_pointer[-1] = b; break; @@ -1307,7 +1307,7 @@ case _IS_NONE: { _Py_UopsSymbol *b; - b = sym_new_not_null(ctx); + b = (void *)sym_new_not_null(ctx); if (b == NULL) goto out_of_space; stack_pointer[-1] = b; break; @@ -1315,7 +1315,7 @@ case _GET_LEN: { _Py_UopsSymbol *len_o; - len_o = sym_new_not_null(ctx); + len_o = (void *)sym_new_not_null(ctx); if (len_o == NULL) goto out_of_space; stack_pointer[0] = len_o; stack_pointer += 1; @@ -1324,7 +1324,7 @@ case _MATCH_CLASS: { _Py_UopsSymbol *attrs; - attrs = sym_new_not_null(ctx); + attrs = (void *)sym_new_not_null(ctx); if (attrs == NULL) goto out_of_space; stack_pointer[-3] = attrs; stack_pointer += -2; @@ -1333,7 +1333,7 @@ case _MATCH_MAPPING: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[0] = res; stack_pointer += 1; @@ -1342,7 +1342,7 @@ case _MATCH_SEQUENCE: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[0] = res; stack_pointer += 1; @@ -1351,7 +1351,7 @@ case _MATCH_KEYS: { _Py_UopsSymbol *values_or_none; - values_or_none = sym_new_not_null(ctx); + values_or_none = (void *)sym_new_not_null(ctx); if (values_or_none == NULL) goto out_of_space; stack_pointer[0] = values_or_none; stack_pointer += 1; @@ -1360,7 +1360,7 @@ case _GET_ITER: { _Py_UopsSymbol *iter; - iter = sym_new_not_null(ctx); + iter = (void *)sym_new_not_null(ctx); if (iter == NULL) goto out_of_space; stack_pointer[-1] = iter; break; @@ -1368,7 +1368,7 @@ case _GET_YIELD_FROM_ITER: { _Py_UopsSymbol *iter; - iter = sym_new_not_null(ctx); + iter = (void *)sym_new_not_null(ctx); if (iter == NULL) goto out_of_space; stack_pointer[-1] = iter; break; @@ -1378,7 +1378,7 @@ case _FOR_ITER_TIER_TWO: { _Py_UopsSymbol *next; - next = sym_new_not_null(ctx); + next = (void *)sym_new_not_null(ctx); if (next == NULL) goto out_of_space; stack_pointer[0] = next; stack_pointer += 1; @@ -1399,7 +1399,7 @@ case _ITER_NEXT_LIST: { _Py_UopsSymbol *next; - next = sym_new_not_null(ctx); + next = (void *)sym_new_not_null(ctx); if (next == NULL) goto out_of_space; stack_pointer[0] = next; stack_pointer += 1; @@ -1418,7 +1418,7 @@ case _ITER_NEXT_TUPLE: { _Py_UopsSymbol *next; - next = sym_new_not_null(ctx); + next = (void *)sym_new_not_null(ctx); if (next == NULL) goto out_of_space; stack_pointer[0] = next; stack_pointer += 1; @@ -1458,7 +1458,7 @@ case _WITH_EXCEPT_START: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[0] = res; stack_pointer += 1; @@ -1468,9 +1468,9 @@ case _PUSH_EXC_INFO: { _Py_UopsSymbol *prev_exc; _Py_UopsSymbol *new_exc; - prev_exc = sym_new_not_null(ctx); + prev_exc = (void *)sym_new_not_null(ctx); if (prev_exc == NULL) goto out_of_space; - new_exc = sym_new_not_null(ctx); + new_exc = (void *)sym_new_not_null(ctx); if (new_exc == NULL) goto out_of_space; stack_pointer[-1] = prev_exc; stack_pointer[0] = new_exc; @@ -1518,7 +1518,7 @@ case _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES: { _Py_UopsSymbol *attr; - attr = sym_new_not_null(ctx); + attr = (void *)sym_new_not_null(ctx); if (attr == NULL) goto out_of_space; stack_pointer[-1] = attr; break; @@ -1526,7 +1526,7 @@ case _LOAD_ATTR_NONDESCRIPTOR_NO_DICT: { _Py_UopsSymbol *attr; - attr = sym_new_not_null(ctx); + attr = (void *)sym_new_not_null(ctx); if (attr == NULL) goto out_of_space; stack_pointer[-1] = attr; break; @@ -1704,7 +1704,7 @@ case _CALL_TYPE_1: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-3] = res; stack_pointer += -2; @@ -1713,7 +1713,7 @@ case _CALL_STR_1: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-3] = res; stack_pointer += -2; @@ -1722,7 +1722,7 @@ case _CALL_TUPLE_1: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-3] = res; stack_pointer += -2; @@ -1738,7 +1738,7 @@ case _CALL_BUILTIN_CLASS: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1747,7 +1747,7 @@ case _CALL_BUILTIN_O: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1756,7 +1756,7 @@ case _CALL_BUILTIN_FAST: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1765,7 +1765,7 @@ case _CALL_BUILTIN_FAST_WITH_KEYWORDS: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1774,7 +1774,7 @@ case _CALL_LEN: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1783,7 +1783,7 @@ case _CALL_ISINSTANCE: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1792,7 +1792,7 @@ case _CALL_METHOD_DESCRIPTOR_O: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1801,7 +1801,7 @@ case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1810,7 +1810,7 @@ case _CALL_METHOD_DESCRIPTOR_NOARGS: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1819,7 +1819,7 @@ case _CALL_METHOD_DESCRIPTOR_FAST: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2 - oparg] = res; stack_pointer += -1 - oparg; @@ -1836,7 +1836,7 @@ case _MAKE_FUNCTION: { _Py_UopsSymbol *func; - func = sym_new_not_null(ctx); + func = (void *)sym_new_not_null(ctx); if (func == NULL) goto out_of_space; stack_pointer[-1] = func; break; @@ -1844,7 +1844,7 @@ case _SET_FUNCTION_ATTRIBUTE: { _Py_UopsSymbol *func; - func = sym_new_not_null(ctx); + func = (void *)sym_new_not_null(ctx); if (func == NULL) goto out_of_space; stack_pointer[-2] = func; stack_pointer += -1; @@ -1876,7 +1876,7 @@ case _BUILD_SLICE: { _Py_UopsSymbol *slice; - slice = sym_new_not_null(ctx); + slice = (void *)sym_new_not_null(ctx); if (slice == NULL) goto out_of_space; stack_pointer[-2 - ((oparg == 3) ? 1 : 0)] = slice; stack_pointer += -1 - ((oparg == 3) ? 1 : 0); @@ -1885,7 +1885,7 @@ case _CONVERT_VALUE: { _Py_UopsSymbol *result; - result = sym_new_not_null(ctx); + result = (void *)sym_new_not_null(ctx); if (result == NULL) goto out_of_space; stack_pointer[-1] = result; break; @@ -1893,7 +1893,7 @@ case _FORMAT_SIMPLE: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-1] = res; break; @@ -1901,7 +1901,7 @@ case _FORMAT_WITH_SPEC: { _Py_UopsSymbol *res; - res = sym_new_not_null(ctx); + res = (void *)sym_new_not_null(ctx); if (res == NULL) goto out_of_space; stack_pointer[-2] = res; stack_pointer += -1; @@ -2077,7 +2077,7 @@ case _POP_TOP_LOAD_CONST_INLINE_BORROW: { _Py_UopsSymbol *value; - value = sym_new_not_null(ctx); + value = (void *)sym_new_not_null(ctx); if (value == NULL) goto out_of_space; stack_pointer[-1] = value; break; diff --git a/Tools/cases_generator/optimizer_generator.py b/Tools/cases_generator/optimizer_generator.py index 1c6b708e82321a..e540d4535d03ec 100644 --- a/Tools/cases_generator/optimizer_generator.py +++ b/Tools/cases_generator/optimizer_generator.py @@ -90,7 +90,7 @@ def emit_default(out: CWriter, uop: Uop) -> None: out.emit(f"{var.name} = sym_new_null(ctx);\n") out.emit(f"if ({var.name} == NULL) goto out_of_space;\n") else: - out.emit(f"{var.name} = sym_new_not_null(ctx);\n") + out.emit(f"{var.name} = (void *)sym_new_not_null(ctx);\n") out.emit(f"if ({var.name} == NULL) goto out_of_space;\n")