Skip to content
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 bullet double to float conversion compiler warnings #503

Merged
merged 14 commits into from
Apr 12, 2023

Conversation

azeey
Copy link
Contributor

@azeey azeey commented Apr 4, 2023

🦟 Bug fix

Summary

Builds on top of #502 to fix double to float warnings that I found using -Wconversion flag.

One issue I ran into is that when we use std::make_shared and std::make_unique, gcc and clang don't catch conversion issues while MSVC does (godbolt example), so to catch those without getting on a windows machine, I implemented my own version of std::make_shared and std::make_unique and did a search/replace. The warnings do show up then, assuming you have -Wconversion enabled in gz-cmake.

template <typename T, typename... Args>
inline std::unique_ptr<T> my_make_unique(Args &&..._arg)
{
  return std::unique_ptr<T>(new T(std::forward<Args>(_arg)...));
}

template <typename T, typename... Args>
inline std::shared_ptr<T> my_make_shared(Args &&..._arg)
{
  return std::shared_ptr<T>(new T(std::forward<Args>(_arg)...));
}

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@azeey azeey requested review from mxgrey and scpeters as code owners April 4, 2023 03:59
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Apr 4, 2023
@codecov
Copy link

codecov bot commented Apr 4, 2023

Codecov Report

Merging #503 (ccaf699) into gz-physics6 (1546641) will increase coverage by 0.01%.
The diff coverage is 70.83%.

❗ Current head ccaf699 differs from pull request most recent head 986f9d9. Consider uploading reports for the commit 986f9d9 to get more accurate results

@@               Coverage Diff               @@
##           gz-physics6     #503      +/-   ##
===============================================
+ Coverage        75.51%   75.52%   +0.01%     
===============================================
  Files              142      142              
  Lines             7175     7191      +16     
===============================================
+ Hits              5418     5431      +13     
- Misses            1757     1760       +3     
Impacted Files Coverage Δ
bullet-featherstone/src/FreeGroupFeatures.cc 0.00% <0.00%> (ø)
bullet/src/JointFeatures.cc 0.00% <0.00%> (ø)
bullet/src/ShapeFeatures.cc 0.00% <0.00%> (ø)
...ullet-featherstone/src/EntityManagementFeatures.cc 30.92% <20.00%> (ø)
bullet-featherstone/src/JointFeatures.cc 41.61% <25.00%> (-1.60%) ⬇️
bullet/src/SDFFeatures.cc 52.56% <70.00%> (-0.23%) ⬇️
bullet-featherstone/src/SDFFeatures.cc 72.47% <84.31%> (+0.50%) ⬆️
bullet-featherstone/src/Base.hh 100.00% <100.00%> (ø)
bullet-featherstone/src/LinkFeatures.cc 66.66% <100.00%> (ø)
bullet-featherstone/src/ShapeFeatures.cc 91.15% <100.00%> (-0.06%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@azeey azeey requested a review from nkoenig April 10, 2023 18:24
@azeey azeey merged commit c596af1 into gazebosim:gz-physics6 Apr 12, 2023
@azeey azeey deleted the fix_bullet_warnings branch April 12, 2023 04:44
@azeey azeey mentioned this pull request Apr 12, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants