From 8db58652d87e3b3bd208aea8f3aad14427780f0a Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Wed, 26 Jul 2023 17:44:50 +0200 Subject: gccrs: proc_macro: Remode function indirection There was no need to register a function when the value could be registered directly. gcc/rust/ChangeLog: * expand/rust-proc-macro.cc (available): Remove function. (load_macros_array): There was no need for an indirection here. libgrust/ChangeLog: * libproc_macro/proc_macro.cc (not_available): Remove function. * libproc_macro/proc_macro.h (not_available): Remove function prototype. * libproc_macro/registration.h: Change symbol type. * libproc_macro/bridge.h: New file. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/expand/rust-proc-macro.cc | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/expand/rust-proc-macro.cc b/gcc/rust/expand/rust-proc-macro.cc index b6cfe25..9fee4bb 100644 --- a/gcc/rust/expand/rust-proc-macro.cc +++ b/gcc/rust/expand/rust-proc-macro.cc @@ -56,12 +56,6 @@ static_assert ( ProcMacro::from_str_function_t>::value, "Registration callback signature not synced, check proc macro internals."); -static bool -available () -{ - return true; -} - template bool register_callback (void *handle, Symbol, std::string symbol_name, @@ -102,7 +96,7 @@ load_macros_array (std::string path) tokenstream_from_string)) return nullptr; if (!REGISTER_CALLBACK (handle, __gccrs_proc_macro_is_available_fn, - available)) + ProcMacro::BridgeState::Available)) return nullptr; // FIXME: Add CrateStableId handling, right now all versions may be loaded, -- cgit v1.1