summaryrefslogtreecommitdiff
path: root/src/apps/cam/camera_session.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-05-01 05:57:11 +0300
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-05-01 11:17:36 +0100
commitaf7d6a4c2df6c836ecc704ea44b39ea07418d832 (patch)
tree21c24709f04e6879909cafb5b3a0fc8f368185d1 /src/apps/cam/camera_session.cpp
parent36435e2aeac66dcba3255c62622154579cc38cd4 (diff)
meson: Ignore -Wredundant-move with gcc-13 and newer
Starting from 13.1, gcc implements the C++23 version of automatic move from local variables in return statements (see https://en.cppreference.com/w/cpp/language/return). As a result, some previously required explicit `std::move()` in return statements generate warnings. This is the case when a function returns an object whose type is a class derived from the class type the function returns: struct U { }; struct T : U { }; U f() { T t; return t; } Up to C++20, the automatic move from local variables selects the move constructor of class U, which is not the move constructor of the expression. Overload resolution is then performed a second time, with t considered as an lvalue. An explicit `std::move(t)` is needed in the return statement to select the U move constructor. Starting from C++23, `t` is treated as an xvalue, and the U move constructor is selected without the need for an explicit `std::move(t)`. An explicit `std:move()` then generates a redundant-move warning, as in the valueOrTuple() function in src/py/libcamera/py_helpers.cpp. Omitting the `std::move()` silences the warning, but selects the copy constructor of U with older gcc versions and with clang, which negatively impacts performance. The easiest fix is to disable the warning. With -Wpessimizing-move enabled, the compiler will still warn of pessimizing moves, only the redundant but not pessimizing moves will be ignored. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/apps/cam/camera_session.cpp')
0 files changed, 0 insertions, 0 deletions