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

[Windows][master] remove GCC extension and alternative operator usage. #1583

Merged
merged 4 commits into from
Aug 14, 2019

Conversation

seanyen
Copy link
Contributor

@seanyen seanyen commented Jul 25, 2019

This change is to replace the gcc extension and alternative operator usage.

  • Replace alternative operator with primary tokens.
  • Replace variable length array with std::vector.
  • Don't do abi::__cxa_demangle when it is using MSVC toolchain.

Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

I am not convinced that the array to std::vector changes were absolutely necessary but otherwise it looks good.

@bmagyar
Copy link
Member

bmagyar commented Jul 25, 2019

@seanyen please run clang-format on the code as per https://moveit.ros.org//documentation/contributing/code/

@@ -1231,7 +1231,7 @@ bool RobotState::getJacobian(const JointModelGroup* group, const LinkModel* link
const JointModel* pjm = link->getParentJointModel();
if (pjm->getVariableCount() > 0)
{
if (not group->hasJointModel(pjm->getName()))
if (!group->hasJointModel(pjm->getName()))
Copy link
Contributor

Choose a reason for hiding this comment

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

what a shame MSVC is still not C++ standards compliant. wasn't there a compiler flag to enable a more compliant mode?

@seanyen seanyen changed the base branch from feature-windows-port to master July 25, 2019 22:36
@seanyen seanyen changed the title [Windows] remove GCC extension and alternative operator usage. [Windows][master] remove GCC extension and alternative operator usage. Jul 25, 2019
std::string demangled_name = abi::__cxa_demangle(adapter_name.c_str(), NULL, NULL, &status);
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessarily something that needs to be addressed in this pull-request, but I would vote for removing this ugly chunk altogether and making the initialize method pure virtual instead.

Any comments by other maintainers?

Copy link
Member

Choose a reason for hiding this comment

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

I agree that this is ugly and should probably be at least abstracted away, we could have a general demangle.h to get these names that'd know how to support different platform on it's own but yes, the best would be to remove hacky stuff like this altogether.

What if we drop the adapter_name variable and define a std::string getAdapterName() = 0;? This would enforce that whoever implement an adapter defines this function to return something. May as well return a correct name. Separate PR though, let's not hold this one up for that.

Copy link
Contributor

@v4hn v4hn Jul 30, 2019

Choose a reason for hiding this comment

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

@bmagyar The logic above will always trigger when initialize is not overridden by the child class.
It's basically a run-time, warning-only version of a pure virtual initialize function.
There is no other place where the adapter name would be needed in the base class.

So instead of adding a new pure virtual method, as you propose, I proposed to enforce the warning condition at compile time by setting virtual void initialize(...) = 0.

@@ -120,14 +120,14 @@ void RobotModelBuilder::addChain(const std::string& section, const std::string&
return;
}
// First link should already be added.
if (not urdf_model_->getLink(link_names[0]))
if (!urdf_model_->getLink(link_names[0]))
Copy link
Member

Choose a reason for hiding this comment

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

not this is not supported in windows?

Copy link
Contributor

Choose a reason for hiding this comment

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

not without setting the compiler to permissive mode or including a special header.
Personally, I prefer the primary tokens to be used throughout the code base, over including windows-specific headers.

@@ -443,20 +443,20 @@ void planning_scene_monitor::CurrentStateMonitor::tfCallback()
continue;
joint_time_[joint] = latest_common_time;

double new_values[joint->getStateSpaceDimension()];
std::vector<double> new_values(joint->getStateSpaceDimension());
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah. They don't support dynamic-size arrays.

Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

Some minor fix required.

Co-Authored-By: Robert Haschke <rhaschke@users.noreply.github.com>
Co-Authored-By: Robert Haschke <rhaschke@users.noreply.github.com>
@v4hn v4hn merged commit f231ad7 into moveit:master Aug 14, 2019
seanyen added a commit to ms-iot/moveit that referenced this pull request Aug 22, 2019
replace the gcc extension and alternative operator usage

Also guard use of Linux-specific abi header
seanyen added a commit to seanyen/moveit that referenced this pull request Feb 8, 2020
replace the gcc extension and alternative operator usage
rhaschke pushed a commit to ubi-agni/moveit that referenced this pull request Feb 8, 2020
replace the gcc extension and alternative operator usage

Also guard use of Linux-specific abi header
sjahr pushed a commit to sjahr/moveit that referenced this pull request Jun 21, 2024
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.

None yet

6 participants