DevHeads.net

compilation of mellowplayer fails on Fedora 30 with gcc-9.0.1 - error: redundant move in return statement [-Werror=redundant-move]

Hi,

the compilation of mellowplayer-3.5.1 with gcc-9.0.1 fails on Fedora 30, see the build.log [1]

Fedora Bugzilla [2] - -Wredundant-move gives false positives in C++11 mode

[1] <a href="https://kojipkgs.fedoraproject.org//work/tasks/2212/32602212/build.log" title="https://kojipkgs.fedoraproject.org//work/tasks/2212/32602212/build.log">https://kojipkgs.fedoraproject.org//work/tasks/2212/32602212/build.log</a>

[2] <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87300" title="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87300">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87300</a>

How can this be solved ?

Regards Martin

Comments

Re: compilation of mellowplayer fails on Fedora 30 with gcc-9.0.

By J. Scheurich at 02/07/2019 - 05:26

the compilation of mellowplayer-3.5.1 with gcc-9.0.1 fails on Fedora 30,
see the build.log [1]
BUILDSTDERR: /builddir/build/BUILD/MellowPlayer-402e336880f94853a541fc3e773e593b584fe8e0/src/3rdparty/boost-di-extensions/Factory.hpp:31:24: required from here
BUILDSTDERR: /builddir/build/BUILD/MellowPlayer-402e336880f94853a541fc3e773e593b584fe8e0/src/3rdparty/boost-di-extensions/Factory.hpp:45:32: error: redundant move in return statement [-Werror=redundant-move]
BUILDSTDERR: /builddir/build/BUILD/MellowPlayer-402e336880f94853a541fc3e773e593b584fe8e0/src/3rdparty/boost-di-extensions/Factory.hpp:45:32: note: remove 'std::move' call
BUILDSTDERR: cc1plus: error: unrecognized command line option '-Wno-c++1z-extensions' [-Werror]
BUILDSTDERR: cc1plus: error: unrecognized command line option '-Wno-unused-private-field' [-Werror]
BUILDSTDERR: cc1plus: all warnings being treated as errors
BUILDSTDERR: make[2]: *** [src/main/CMakeFiles/MellowPlayer.dir/build.make:150: src/main/CMakeFiles/MellowPlayer.dir/Program.cpp.o] Error 1
BUILDSTDERR: make[1]: *** [CMakeFiles/Makefile2:515: src/main/CMakeFiles/MellowPlayer.dir/all] Error 2
BUILDSTDERR: make: *** [Makefile:133: all] Error 2
RPM build errors:
BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.CD4l4Z (%build)
BUILDSTDERR: Bad exit status from /var/tmp/rpm-tmp.CD4l4Z (%build)
Child return code was: 1
EXCEPTION: [Error()]
Traceback (most recent call last):

it looks lie the options  -Wno-c++1z-extensions and
-Wno-unused-private-field' are wrong

...

UILDSTDERR: /builddir/build/BUILD/MellowPlayer-402e336880f94853a541fc3e773e593b584fe8e0/src/3rdparty/boost-di-extensions/Factory.hpp:31:24: required from here
BUILDSTDERR: /builddir/build/BUILD/MellowPlayer-402e336880f94853a541fc3e773e593b584fe8e0/src/3rdparty/boost-di-extensions/Factory.hpp:45:32: error: redundant move in return statement [-Werror=redundant-move]
BUILDSTDERR: 45 | return std::move(object);
BUILDSTDERR: | ^

<a href="https://stackoverflow.com/questions/9532608/is-returning-with-stdmove-sensible-in-the-case-of-multiple-return-statements" title="https://stackoverflow.com/questions/9532608/is-returning-with-stdmove-sensible-in-the-case-of-multiple-return-statements">https://stackoverflow.com/questions/9532608/is-returning-with-stdmove-se...</a>

For local variables, there's no need to |std::move| them in the |return|
statement most of the time^† , since the language actually demands that
this happens automatically:

||

Re: compilation of mellowplayer fails on Fedora 30 with gcc-9.0.

By Martin Gansser at 02/07/2019 - 07:18

Thanks for your reply.

I will pass this information on to the developer of mellowplayer because I can not make these changes myself.

Re: compilation of mellowplayer fails on Fedora 30 with gcc-9.0.

By Leigh Scott at 02/07/2019 - 08:59

<a href="https://paste.fedoraproject.org/paste/0UcXKIQa-Nsqha~eV1scKA/raw" title="https://paste.fedoraproject.org/paste/0UcXKIQa-Nsqha~eV1scKA/raw">https://paste.fedoraproject.org/paste/0UcXKIQa-Nsqha~eV1scKA/raw</a>

Re: compilation of mellowplayer fails on Fedora 30 with gcc-9.0.

By Martin Gansser at 02/07/2019 - 09:19

Works for me, many thanks.

Re: compilation of mellowplayer fails on Fedora 30 with gcc-9.0.

By Jakub Jelinek at 02/07/2019 - 05:17

On Thu, Feb 07, 2019 at 10:08:26AM -0000, Martin Gansser wrote:
It is a warning (-Wextra enabled only even), if you are using -Werror, you
need to be prepared to deal with warnings. See info gcc on the rationale
for the warning.

Jakub

Re: compilation of mellowplayer fails on Fedora 30 with gcc-9.0.

By Jakub Jelinek at 02/07/2019 - 05:29

On Thu, Feb 07, 2019 at 11:17:58AM +0100, Jakub Jelinek wrote:
And also see <a href="http://gcc.gnu.org/PR86981" title="http://gcc.gnu.org/PR86981">http://gcc.gnu.org/PR86981</a> and <a href="http://gcc.gnu.org/PR87029" title="http://gcc.gnu.org/PR87029">http://gcc.gnu.org/PR87029</a>

Jakub