]> git.ipfire.org Git - thirdparty/gcc.git/commit
libcc1: use variadic templates for callbacks
authorTom Tromey <tom@tromey.com>
Tue, 4 May 2021 21:26:58 +0000 (15:26 -0600)
committerTom Tromey <tom@tromey.com>
Wed, 5 May 2021 06:06:18 +0000 (00:06 -0600)
commit8fdffa48c57f13b90556bc179150d24efdeeeef5
tree6b946a1fe949ce299c120d384e8d844eeab0ad87
parentee75ca6b72e4235aa48d6fb30c5cd274f2ff6b67
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.
libcc1/connection.cc
libcc1/libcc1.cc
libcc1/libcc1plugin.cc
libcc1/libcp1.cc
libcc1/libcp1plugin.cc
libcc1/rpc.hh