Skip to content

Commit 97e202a

Browse files
tomershafiravikivity
authored andcommitted
sharded.hh: remove inline from templates
Templates are distinctly defined in each translation unit, thus they dont cause multiple definitions linkage error, so inline is redundant code to compile.
1 parent e288351 commit 97e202a

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

include/seastar/core/sharded.hh

+2-19
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ public:
400400
///
401401
/// \see map_reduce(Iterator begin, Iterator end, Mapper&& mapper, Reducer&& r)
402402
template <typename Reducer, typename Func, typename... Args>
403-
inline
404403
auto map_reduce(Reducer&& r, Func&& func, Args&&... args) -> typename reducer_traits<Reducer>::future_type
405404
{
406405
auto rng = std::views::iota(size_t(0), _instances.size());
@@ -417,7 +416,6 @@ public:
417416

418417
/// The const version of \ref map_reduce(Reducer&& r, Func&& func)
419418
template <typename Reducer, typename Func, typename... Args>
420-
inline
421419
auto map_reduce(Reducer&& r, Func&& func, Args&&... args) const -> typename reducer_traits<Reducer>::future_type
422420
{
423421
auto rng = std::views::iota(size_t(0), _instances.size());
@@ -449,7 +447,6 @@ public:
449447
/// \return Result of invoking `map` with each instance in parallel, reduced by calling
450448
/// `reduce()` on each adjacent pair of results.
451449
template <typename Mapper, typename Initial, typename Reduce>
452-
inline
453450
future<Initial>
454451
map_reduce0(Mapper map, Initial initial, Reduce reduce) {
455452
auto wrapped_map = [this, map] (unsigned c) {
@@ -466,7 +463,6 @@ public:
466463

467464
/// The const version of \ref map_reduce0(Mapper map, Initial initial, Reduce reduce)
468465
template <typename Mapper, typename Initial, typename Reduce>
469-
inline
470466
future<Initial>
471467
map_reduce0(Mapper map, Initial initial, Reduce reduce) const {
472468
auto wrapped_map = [this, map] (unsigned c) {
@@ -491,7 +487,7 @@ public:
491487
/// \tparam Mapper unary function taking `Service&` and producing some result.
492488
/// \return Result vector of invoking `map` with each instance in parallel
493489
template <typename Mapper, typename Future = futurize_t<std::invoke_result_t<Mapper,Service&>>, typename return_type = decltype(internal::untuple(std::declval<typename Future::tuple_type>()))>
494-
inline future<std::vector<return_type>> map(Mapper mapper) {
490+
future<std::vector<return_type>> map(Mapper mapper) {
495491
return do_with(std::vector<return_type>(), std::move(mapper),
496492
[this] (std::vector<return_type>& vec, Mapper& mapper) mutable {
497493
vec.resize(_instances.size());
@@ -588,7 +584,6 @@ sharded<Service>::~sharded() {
588584
namespace internal {
589585

590586
template <typename T>
591-
inline
592587
T&&
593588
unwrap_sharded_arg(T&& arg) {
594589
return std::forward<T>(arg);
@@ -706,20 +701,17 @@ struct sharded_call_stop {
706701

707702
template <>
708703
template <typename Service>
709-
inline
710704
future<> sharded_call_stop<true>::call(Service& instance) {
711705
return instance.stop();
712706
}
713707

714708
template <>
715709
template <typename Service>
716-
inline
717710
future<> sharded_call_stop<false>::call(Service&) {
718711
return make_ready_future<>();
719712
}
720713

721714
template <typename Service>
722-
inline
723715
future<>
724716
stop_sharded_instance(Service& instance) {
725717
constexpr bool has_stop = internal::sharded_has_stop::check<Service>(0);
@@ -773,7 +765,6 @@ sharded<Service>::invoke_on_all(smp_submit_to_options options, std::function<fut
773765
}
774766

775767
template <typename Service>
776-
inline
777768
future<>
778769
sharded<Service>::invoke_on_all(std::function<future<> (Service&)> func) noexcept {
779770
try {
@@ -787,7 +778,6 @@ template <typename Service>
787778
template <typename Func, typename... Args>
788779
requires std::invocable<Func, Service&, internal::sharded_unwrap_t<Args>...>
789780
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, internal::sharded_unwrap_t<Args>...>>, future<>>
790-
inline
791781
future<>
792782
sharded<Service>::invoke_on_all(smp_submit_to_options options, Func func, Args... args) noexcept {
793783
try {
@@ -805,7 +795,6 @@ template <typename Service>
805795
template <typename Func, typename... Args>
806796
requires std::invocable<Func, Service&, internal::sharded_unwrap_t<Args>...>
807797
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, internal::sharded_unwrap_t<Args>...>>, future<>>
808-
inline
809798
future<>
810799
sharded<Service>::invoke_on_all(Func func, Args... args) noexcept {
811800
try {
@@ -819,7 +808,6 @@ template <typename Service>
819808
template <typename Func, typename... Args>
820809
requires std::invocable<Func, Service&, Args...>
821810
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, Args...>>, future<>>
822-
inline
823811
future<>
824812
sharded<Service>::invoke_on_others(smp_submit_to_options options, Func func, Args... args) noexcept {
825813
try {
@@ -835,7 +823,6 @@ template <typename Service>
835823
template <typename Func, typename... Args>
836824
requires std::invocable<Func, Service&, Args...>
837825
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, Args...>>, future<>>
838-
inline
839826
future<>
840827
sharded<Service>::invoke_on_others(Func func, Args... args) noexcept {
841828
try {
@@ -848,7 +835,6 @@ sharded<Service>::invoke_on_others(Func func, Args... args) noexcept {
848835
template <typename Service>
849836
template <typename Func, typename... Args, typename Ret>
850837
requires std::invocable<Func, Service&, Args&&...>
851-
inline
852838
Ret
853839
sharded<Service>::invoke_on(unsigned id, smp_submit_to_options options, Func&& func, Args&&... args) {
854840
return smp::submit_to(id, options, [this, func = std::forward<Func>(func), args = std::tuple(std::move(args)...)] () mutable {
@@ -860,7 +846,6 @@ sharded<Service>::invoke_on(unsigned id, smp_submit_to_options options, Func&& f
860846
template <typename Service>
861847
template <typename Func, typename... Args, typename Ret>
862848
requires std::invocable<Func, Service&, Args&&...>
863-
inline
864849
Ret
865850
sharded<Service>::invoke_on(unsigned id, Func&& func, Args&&... args) {
866851
return invoke_on(id, smp_submit_to_options(), std::forward<Func>(func), std::forward<Args>(args)...);
@@ -871,7 +856,6 @@ template <typename R, typename Func, typename... Args>
871856
requires std::invocable<Func, Service&, Args...>
872857
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, internal::sharded_unwrap_t<Args>...>>, future<>>
873858
&& internal::unsigned_range<R>
874-
inline
875859
future<>
876860
sharded<Service>::invoke_on(R range, smp_submit_to_options options, Func func, Args... args) noexcept {
877861
try {
@@ -898,7 +882,6 @@ template <typename R, typename Func, typename... Args>
898882
requires std::invocable<Func, Service&, Args...>
899883
&& std::is_same_v<futurize_t<std::invoke_result_t<Func, Service&, internal::sharded_unwrap_t<Args>...>>, future<>>
900884
&& internal::unsigned_range<R>
901-
inline
902885
future<>
903886
sharded<Service>::invoke_on(R range, Func func, Args... args) noexcept {
904887
try {
@@ -927,7 +910,7 @@ shared_ptr<Service> sharded<Service>::local_shared() noexcept {
927910
}
928911

929912
template <typename Service>
930-
inline bool sharded<Service>::local_is_initialized() const noexcept {
913+
bool sharded<Service>::local_is_initialized() const noexcept {
931914
return _instances.size() > this_shard_id() &&
932915
_instances[this_shard_id()].service;
933916
}

0 commit comments

Comments
 (0)