librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

librealsense-2.40.0/src/media/ros/ros_reader.cpp:514:Wpessimizing-move

Open dcb314 opened this issue 2 years ago • 5 comments

Recent development versions of gcc can be made to say:

/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/media/ros/ros_reader.cpp:514:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]

Source code is

    return std::move(fh);

I think some code rework would make it run faster.

dcb314 avatar Aug 21 '22 17:08 dcb314

Hi @dcb314 If yourself or another RealSense user develop an edit of the source code that improves performance then you are very welcome to share it as a pull request so that it can be evaluated by the Intel RealSense developer team for inclusion in the RealSense SDK. Thanks!

https://github.com/IntelRealSense/librealsense/pulls

MartyG-RealSense avatar Aug 22 '22 07:08 MartyG-RealSense

Thanks for your offer. I don't do pull requests.

There were a bunch more of the same warning in the package.

  3 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/common/opengl3.cpp:599:21: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
 70 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/include/librealsense2/hpp/rs_device.hpp:677:48: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
 70 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/include/librealsense2/hpp/rs_device.hpp:680:29: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
  1 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/context.cpp:545:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
  9 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/gl/../../include/librealsense2/hpp/rs_device.hpp:677:48: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
  9 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/gl/../../include/librealsense2/hpp/rs_device.hpp:680:29: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
 12 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/../include/librealsense2/hpp/rs_device.hpp:677:48: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
 12 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/../include/librealsense2/hpp/rs_device.hpp:680:29: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
  1 fedora/pass297/20220820/librealsense.spec.out:/home/dcb36/rpmbuild/BUILD/librealsense-2.40.0/src/media/ros/ros_reader.cpp:514:25: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]

Column 1 is a count of the number of times the warning occurred in the build.

dcb314 avatar Aug 22 '22 08:08 dcb314

This warning has never been previously reported by librealsense users. Have you experienced it in earlier gcc versions?

MartyG-RealSense avatar Aug 22 '22 08:08 MartyG-RealSense

The warning has recently been enhanced in development versions of gcc.

The most recently released version of gcc (12.2) might produce some of these warnings.

dcb314 avatar Aug 22 '22 09:08 dcb314

Let's keep this case open and see whether anybody else reports a similar problem in future with recent development versions of gcc. Thanks very much for the report!

MartyG-RealSense avatar Aug 22 '22 11:08 MartyG-RealSense