Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

build:
name: build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
continue-on-error: true

strategy:
Expand All @@ -52,7 +52,7 @@ jobs:

- name: install boost
run: |
sudo apt install libboost-tools-dev libboost-dev libboost-system-dev
sudo apt install libboost-python-dev libboost-tools-dev libboost-dev libboost-system-dev python3
echo "using gcc ;" >>~/user-config.jam

- name: install gcrypt
Expand All @@ -61,18 +61,23 @@ jobs:

- name: build library
run: |
b2 ${{ matrix.config }} cxxstd=14
b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on

- name: build examples
run: |
cd examples
b2 ${{ matrix.config }}
b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on

- name: build tools
run: |
cd tools
b2 ${{ matrix.config }} warnings-as-errors=on
b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on

- name: build python bindings
run: |
cd bindings/python
echo "using python ;" >>~/user-config.jam
BOOST_ROOT="" b2 ${{ matrix.config }} cxxstd=14,17,20 warnings-as-errors=on


fuzzers:
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/src/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct entry_to_python
result.append(*i);
}

return std::move(result);
return TORRENT_RVO(result);
}

static object convert(entry::dictionary_type const& d)
Expand All @@ -30,7 +30,7 @@ struct entry_to_python
for (entry::dictionary_type::const_iterator i(d.begin()), e(d.end()); i != e; ++i)
result[bytes(i->first)] = i->second;

return std::move(result);
return TORRENT_RVO(result);
}

static object convert0(entry const& e)
Expand Down
6 changes: 6 additions & 0 deletions include/libtorrent/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,12 @@ POSSIBILITY OF SUCH DAMAGE.
#define __has_builtin(x) 0 // for non-clang compilers
#endif

#if __cplusplus >= 202002L
#define TORRENT_RVO(x) x
#else
#define TORRENT_RVO(x) std::move(x)
#endif

#if (TORRENT_HAS_SSE && defined __GNUC__)
# define TORRENT_HAS_BUILTIN_CLZ 1
#elif (TORRENT_HAS_ARM && defined __GNUC__ && !defined __clang__)
Expand Down
6 changes: 3 additions & 3 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2579,7 +2579,7 @@ namespace {
for (int i = 0; i < m_v6_num_peers; i++)
peers.push_back(aux::read_v6_endpoint<tcp::endpoint>(v6_ptr));

return std::move(peers);
return TORRENT_RVO(peers);
}

dht_direct_response_alert::dht_direct_response_alert(
Expand Down Expand Up @@ -2819,7 +2819,7 @@ namespace {
nodes.emplace_back(ih, aux::read_v6_endpoint<udp::endpoint>(v6_ptr));
}

return std::move(nodes);
return TORRENT_RVO(nodes);
}
}

Expand Down Expand Up @@ -2931,7 +2931,7 @@ namespace {
char const* ptr = m_alloc.get().ptr(m_samples_idx);
std::memcpy(samples.data(), ptr, samples.size() * 20);

return std::move(samples);
return TORRENT_RVO(samples);
}

int dht_sample_infohashes_alert::num_nodes() const
Expand Down
2 changes: 1 addition & 1 deletion src/session_stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ namespace {
stats[i].type = metrics[i].value_index >= counters::num_stats_counters
? metric_type_t::gauge : metric_type_t::counter;
}
return std::move(stats);
return TORRENT_RVO(stats);
}

int find_metric_idx(string_view name)
Expand Down
6 changes: 3 additions & 3 deletions src/torrent_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ namespace libtorrent {
{
aux::vector<std::int64_t, file_index_t> ret;
sync_call(&torrent::file_progress, std::ref(ret), flags);
return std::move(ret);
return TORRENT_RVO(ret);
}

void torrent_handle::post_file_progress(file_progress_flags_t const flags) const
Expand Down Expand Up @@ -542,7 +542,7 @@ namespace libtorrent {
aux::vector<download_priority_t, piece_index_t> ret;
auto retp = &ret;
sync_call(&torrent::piece_priorities, retp);
return std::move(ret);
return TORRENT_RVO(ret);
}

#if TORRENT_ABI_VERSION == 1
Expand Down Expand Up @@ -598,7 +598,7 @@ namespace libtorrent {
aux::vector<download_priority_t, file_index_t> ret;
auto retp = &ret;
sync_call(&torrent::file_priorities, retp);
return std::move(ret);
return TORRENT_RVO(ret);
}

#if TORRENT_ABI_VERSION == 1
Expand Down