Fix compiler warnings related to gtest/gmock#408
Conversation
definition of implicit copy constructor ... is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy] Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
161989d to
acb3a55
Compare
|
Rather than disabling more warnings, I wonder if it would help to upgrade to gmock 1.11.0, which would match what is in Ubuntu 22.04 anyway. Can you give that a try and see if it resolves these warnings? |
|
You are right, according to this, gtest/gmock 1.11 should resolve the clang compiler warnings. However, `ament-cmake-gtest` / `ament-cmake-gmock` have issues building this version.CMake Error at /usr/src/googletest/googletest/cmake/internal_utils.cmake:158 (add_library): add_library cannot create target "gtest" because another target with the same name already exists. The existing target is a static library created in source directory "/opt/ros/rolling/src/gtest_vendor". See documentation for policy CMP0002 for more details. Call Stack (most recent call first): /usr/src/googletest/googletest/cmake/internal_utils.cmake:215 (cxx_library_with_type) /usr/src/googletest/googletest/CMakeLists.txt:133 (cxx_library) I just force-removed the vendor packages like so: dpkg -r --force-depends ros-rolling-gmock-vendor dpkg -r --force-depends ros-rolling-gtest-vendor and then built from scratch. I don't have enough insight into these ament packages to fix this issue. |
|
Can you try out ament/googletest#21 ? |
Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
Yes, that works: https://github.com/ubi-agni/moveit_task_constructor/actions/runs/3413457294/jobs/5680185989. Thanks! Maybe we can remove those warning relaxation completely. I added an appropriate commit and the test succeeded as well. |
|
@clalancette, any update on this? ament/googletest#21 fixes the warnings, but wasn't touched for 2 months. |
Unfortunately, it introduces new warnings, and I haven't had time to look into them. |
|
What about merging this PR then? gtest and gmock should be handled as external sources, i.e. using |
|
I do think we should upgrade gtest to version 1.11, but that doesn't block this PR. This looks OK, I'll run CI on it and see what comes back. |
clalancette
left a comment
There was a problem hiding this comment.
Looks good with green CI.
* Suppress compiler warnings when building gmock definition of implicit copy constructor ... is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy] * Declare gtest/gmock include dirs as SYSTEM PRIVATE for test targets Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
* Suppress compiler warnings when building gmock definition of implicit copy constructor ... is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy] * Declare gtest/gmock include dirs as SYSTEM PRIVATE for test targets Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de> Signed-off-by: atzaros <128592691+atzaros@users.noreply.github.com>
* Suppress compiler warnings when building gmock definition of implicit copy constructor ... is deprecated because it has a user-declared copy assignment operator [-Wdeprecated-copy] * Declare gtest/gmock include dirs as SYSTEM PRIVATE for test targets Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de> Signed-off-by: atzaros <128592691+atzaros@users.noreply.github.com> Co-authored-by: Robert Haschke <rhaschke@users.noreply.github.com>
With clang and rather strict settings for compiler warnings, downstream projects fail to build due to issues in gtest/gmock:
https://github.com/ubi-agni/moveit_task_constructor/actions/runs/3372692498/jobs/5596418220
This PR extends #94 introduced by @dirk-thomas by:
-Wno-deprecated-copyto the_gmock_compile_flagsSYSTEM, such that compilers ignore issues in those headers