Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant move in return statement #7488

Closed
wants to merge 1 commit into from

Conversation

Chocobo1
Copy link
Contributor

This suppresses the following warning from gcc 13.2.1:

/home/user/libtorrent-rasterbar-2_0-git/src/libtorrent/bindings/python/src/entry.cpp:23:25: warning: redundant move in return statement [-Wredundant-move]
   23 |         return std::move(result);
      |                ~~~~~~~~~^~~~~~~~

Also refer to the manual:
https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/C_002b_002b-Dialect-Options.html#index-Wredundant-move

This suppresses the following warning from gcc 13.2.1:
>/home/user/libtorrent-rasterbar-2_0-git/src/libtorrent/bindings/python/src/entry.cpp:23:25: warning: redundant move in return statement [-Wredundant-move]
   23 |         return std::move(result);
      |                ~~~~~~~~~^~~~~~~~

Also refer to the manual:
https://gcc.gnu.org/onlinedocs/gcc-13.2.0/gcc/C_002b_002b-Dialect-Options.html#index-Wredundant-move
@Chocobo1
Copy link
Contributor Author

It seems clang-10 gives opposite warnings: https://github.com/arvidn/libtorrent/actions/runs/5909524042/job/16030198579?pr=7488#step:8:32 or perhaps clang 10 is simply outdated.

This blog post actually suggest not using std::move in those cases (the paragraph about Wpessimizing-move): https://developers.redhat.com/blog/2019/04/12/understanding-when-not-to-stdmove-in-c
However this might be specific to gcc and clang thinks differently, I'm not sure.

Anyway I'll leave this PR open and let you (arvidn) decide.

@arvidn
Copy link
Owner

arvidn commented Aug 24, 2023

I made this: #7501

@Chocobo1
Copy link
Contributor Author

Superseded by #7501.

@Chocobo1 Chocobo1 closed this Aug 24, 2023
@Chocobo1 Chocobo1 deleted the fix branch August 24, 2023 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants