Skip to content

C++20, compiler warnings#5

Open
wyattrees wants to merge 2 commits intoPickNikRobotics:ros2from
wyattrees:compiler-warnings
Open

C++20, compiler warnings#5
wyattrees wants to merge 2 commits intoPickNikRobotics:ros2from
wyattrees:compiler-warnings

Conversation

@wyattrees
Copy link
Copy Markdown

For a list of compiler warnings used, see cmake/CompilerWarnings.cmake.

This PR omits running clang-format, as the diff would be nearly impossible to tell what actually meaningful changes were made.

@wyattrees wyattrees force-pushed the compiler-warnings branch from e8891be to dd784d7 Compare June 8, 2022 21:40
Comment on lines +133 to +135
: frame_(Frame::identity())
, rotation_scale_(0.5)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to take the modernization even further, you could look for data members like this which are initialized with constants and move their initialization to where they're declared.

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-default

This can easily be saved for a later PR, but I wanted to mention it since it's one of my fav C++ features.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know!

Comment thread CMakeLists.txt Outdated
enable_doxygen()

# allow for static analysis options
include(cmake/StaticAnalyzers.cmake)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless CI is also exercising the sanitizers, doxygen, and static analyzers, I'm not convinced this is worth adding.

Comment thread src/kinematics_plugin.cpp Outdated
BioIKKinematicsPlugin() { enable_profiler = false; }

virtual const std::vector<std::string> &getJointNames() const {
virtual const std::vector<std::string> &getJointNames() const override {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

override implies virtual so if you're using override you can remove virtual.

Comment thread src/kinematics_plugin.cpp
std::string *error_text_out = 0) const {
virtual bool supportsGroup(
const moveit::core::JointModelGroup */*jmg*/,
std::string */*error_text_out*/ = 0) const override {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You changed the type of these parameters. They used to be pointer types and now they're values.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there's still a '*' before the commented out parameter names?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I read that wrong

Comment thread src/utils.h
BASE* create(ARGS... args) const { return new DERIVED(args...); }
BASE* clone(const BASE* o) const { return new DERIVED(*(const DERIVED*)o); }
Class(const std::string& name)
BASE* clone(const BASE* o) const { return new DERIVED(*dynamic_cast<const DERIVED*>(o)); }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this dynamic cast fails, a null pointer will be dereferenced. How sure are we that it will never fail?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really sure, to be honest. I think if we verify that all of the different kinematic solver modes work, as this is used to instantiate the different types of solvers, then it should be OK. I'll run a quick test to be sure.

@ChrisThrasher
Copy link
Copy Markdown

@tylerjw If you think bio_ik deserves some more attention, check out this PR. It makes some much needed best practices improvements.

@wyattrees wyattrees force-pushed the compiler-warnings branch from dd784d7 to 680b5c5 Compare July 15, 2022 19:42
Comment thread include/bio_ik/frame.h
{
Vector3 pos;
double __padding[4 - (sizeof(Vector3) / sizeof(double))];
// TODO(wyattrees): is __padding needed? rename without double underscore?
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it might be for getting the Quaternion to be on some address multiple so it is optimized for simd instructions. Honestly I feel like much of these optimizations here are not justified without benchmarks and make the code considerably harder to read without any justification for their existance.

@wyattrees wyattrees force-pushed the compiler-warnings branch from 680b5c5 to 1bb5899 Compare July 18, 2022 17:41
@wyattrees
Copy link
Copy Markdown
Author

note that c++20 has been dropped in favor of c++17 for Humble support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants