summaryrefslogtreecommitdiff
path: root/libcc1/libcc1.cc
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-05-04 15:26:58 -0600
committerTom Tromey <tom@tromey.com>2021-05-05 00:06:18 -0600
commit8fdffa48c57f13b90556bc179150d24efdeeeef5 (patch)
tree6b946a1fe949ce299c120d384e8d844eeab0ad87 /libcc1/libcc1.cc
parentee75ca6b72e4235aa48d6fb30c5cd274f2ff6b67 (diff)
downloadgcc-8fdffa48c57f13b90556bc179150d24efdeeeef5.tar.gz
libcc1: use variadic templates for callbacks
This patch completes the transition of libcc1 from the use of separate template functions for different arities to the use of variadic functions. This is how I had wanted it to work from the very beginning, and is possible now with C++11. I had thought that variadic callbacks required C++17, but it turns out that the approach taken here is basically equivalent to std::apply -- just a bit wordier. libcc1 * rpc.hh (argument_wrapper) <get>: Replace cast operator. (argument_wrapper<T *>) <get>: Likewise. (unmarshall): Add std::tuple overloads. (callback): Remove. (class invoker): New. * libcp1plugin.cc (plugin_init): Update. * libcp1.cc (libcp1::add_callbacks): Update. * libcc1plugin.cc (plugin_init): Update. * libcc1.cc (libcc1::add_callbacks): Update. * connection.cc (cc1_plugin::connection::do_wait): Update.
Diffstat (limited to 'libcc1/libcc1.cc')
-rw-r--r--libcc1/libcc1.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/libcc1/libcc1.cc b/libcc1/libcc1.cc
index cbc54ee0a04..febadc8420b 100644
--- a/libcc1/libcc1.cc
+++ b/libcc1/libcc1.cc
@@ -143,15 +143,13 @@ void
libcc1::add_callbacks ()
{
cc1_plugin::callback_ftype *fun
- = cc1_plugin::callback<int,
- enum gcc_c_oracle_request,
- const char *,
- c_call_binding_oracle>;
+ = cc1_plugin::invoker<int,
+ enum gcc_c_oracle_request,
+ const char *>::invoke<c_call_binding_oracle>;
connection->add_callback ("binding_oracle", fun);
- fun = cc1_plugin::callback<gcc_address,
- const char *,
- c_call_symbol_address>;
+ fun = cc1_plugin::invoker<gcc_address,
+ const char *>::invoke<c_call_symbol_address>;
connection->add_callback ("address_oracle", fun);
}