-
Notifications
You must be signed in to change notification settings - Fork 132
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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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-copy
to the_gmock_compile_flags
SYSTEM
, such that compilers ignore issues in those headers