https://gcc.gnu.org/g:648679ecb243ccc570ebb9b4a425824a6a4382fd
commit r17-5935-g648679ecb243ccc570ebb9b4a425824a6a4382fd Author: Sriram Raghunathan <[email protected]> Date: Tue Oct 27 13:55:20 2026 -0700 gccrs: Remove the function_defer_statement helper. This patch removes the function_defer_statement, this is a feature available in go and rust doesn't support this. gcc/rust/ChangeLog: * rust-backend.h (function_defer_statement): Remove. * rust-gcc.cc (function_defer_statement): Remove. Signed-off-by: Sriram Raghunathan <[email protected]> Diff: --- gcc/rust/rust-backend.h | 7 ------- gcc/rust/rust-gcc.cc | 35 ----------------------------------- 2 files changed, 42 deletions(-) diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index ecd86836262b..e3013cbb3367 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -431,13 +431,6 @@ static const unsigned int function_in_unique_section = 1 << 3; tree function (tree fntype, GGC::Ident name, tl::optional<GGC::Ident> asm_name, unsigned int flags, location_t); -// Create a statement that runs all deferred calls for FUNCTION. This should -// be a statement that looks like this in C++: -// finish: -// try { DEFER_RETURN; } catch { CHECK_DEFER; goto finish; } -tree function_defer_statement (tree function, tree undefer, tree check_defer, - location_t); - // Record PARAM_VARS as the variables to use for the parameters of FUNCTION. // This will only be called for a function definition. Returns true on // success, false on failure. diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index b3e5a5cdddc4..00df8b3b9178 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -2388,41 +2388,6 @@ function (tree functype, GGC::Ident name, tl::optional<GGC::Ident> asm_name, return decl; } -// Create a statement that runs all deferred calls for FUNCTION. This should -// be a statement that looks like this in C++: -// finish: -// try { UNDEFER; } catch { CHECK_DEFER; goto finish; } - -tree -function_defer_statement (tree function, tree undefer_tree, tree defer_tree, - location_t location) -{ - if (error_operand_p (undefer_tree) || error_operand_p (defer_tree) - || error_operand_p (function)) - return error_mark_node; - - if (DECL_STRUCT_FUNCTION (function) == NULL) - push_struct_function (function); - else - push_cfun (DECL_STRUCT_FUNCTION (function)); - - tree stmt_list = NULL; - tree label = Backend::label (function, tl::nullopt, location); - tree label_def = label_definition_statement (label); - append_to_statement_list (label_def, &stmt_list); - - tree jump_stmt = goto_statement (label, location); - tree catch_body - = build2 (COMPOUND_EXPR, void_type_node, defer_tree, jump_stmt); - catch_body = build2 (CATCH_EXPR, void_type_node, NULL, catch_body); - tree try_catch - = build2 (TRY_CATCH_EXPR, void_type_node, undefer_tree, catch_body); - append_to_statement_list (try_catch, &stmt_list); - pop_cfun (); - - return stmt_list; -} - // Record PARAM_VARS as the variables to use for the parameters of FUNCTION. // This will only be called for a function definition.
