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

Clean up various warnings caught by clang12 #1421

Merged
merged 5 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ install(TARGETS sdformat
configure_build_install_location(gazebo)
configure_build_install_location(common)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Workaround for Clang and pybind11 on Focal
# https:/pybind/pybind11/issues/1604
# Resolved by newer versions of pybind11
if(${pybind11_VERSION} VERSION_LESS "2.4.4")
target_compile_options(common PRIVATE -fsized-deallocation)
target_compile_options(gazebo PRIVATE -fsized-deallocation)
target_compile_options(sdformat PRIVATE -fsized-deallocation)
endif()
endif()


if (BUILD_TESTING)
set(python_tests
testFixture_TEST
Expand Down
2 changes: 0 additions & 2 deletions src/gui/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1908,8 +1908,6 @@ void IgnRenderer::HandleMouseTransformControl()
this->dataPtr->startWorldPos =
target->WorldPosition();
}
ignition::math::Vector3d worldPos =
target->WorldPosition();
math::Vector3d distance =
this->dataPtr->transformControl.TranslationFrom2d(axis, start, end);
if (this->dataPtr->keyEvent.Control())
Expand Down
1 change: 0 additions & 1 deletion src/gui/plugins/transform_control/TransformControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ void TransformControlPrivate::HandleTransform()
this->isStartWorldPosSet = true;
this->startWorldPos = target->WorldPosition();
}
ignition::math::Vector3d worldPos = target->WorldPosition();
math::Vector3d distance =
this->transformControl.TranslationFrom2d(axis, start, end);
if (this->keyEvent.Control())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ void VisualizationCapabilitiesPrivate::ViewCollisions(const Entity &_entity)
}

// Find all existing child links for this entity
std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
std::vector<Entity> links = this->FindChildLinks(_entity);

for (const auto &link : links)
{
Expand Down Expand Up @@ -1828,7 +1828,7 @@ void VisualizationCapabilitiesPrivate::ViewCollisions(const Entity &_entity)
/////////////////////////////////////////////////
void VisualizationCapabilitiesPrivate::ViewInertia(const Entity &_entity)
{
std::vector<Entity> inertiaLinks = std::move(this->FindChildLinks(_entity));
std::vector<Entity> inertiaLinks = this->FindChildLinks(_entity);

// check if _entity has an inertial component (_entity is a link)
if (this->entityInertials.find(_entity) !=
Expand Down Expand Up @@ -1956,7 +1956,7 @@ void VisualizationCapabilitiesPrivate::ViewJoints(const Entity &_entity)
/////////////////////////////////////////////////
void VisualizationCapabilitiesPrivate::ViewCOM(const Entity &_entity)
{
std::vector<Entity> inertiaLinks = std::move(this->FindChildLinks(_entity));
std::vector<Entity> inertiaLinks = this->FindChildLinks(_entity);

// check if _entity has an inertial component (_entity is a link)
if (this->entityInertials.find(_entity) !=
Expand Down Expand Up @@ -2014,7 +2014,7 @@ void VisualizationCapabilitiesPrivate::ViewWireframes(const Entity &_entity)
}

// Find all existing child links for this entity
std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
std::vector<Entity> links = this->FindChildLinks(_entity);

for (const auto &link : links)
{
Expand Down Expand Up @@ -2068,7 +2068,7 @@ void VisualizationCapabilitiesPrivate::ViewFrames(const Entity &_entity)
bool showFrames = (this->viewingFrames.find(_entity) ==
this->viewingFrames.end()) || !this->viewingFrames[_entity];

auto descendants = std::move(this->FindChildFrames(_entity));
auto descendants = this->FindChildFrames(_entity);

for (const auto &descendant : descendants)
{
Expand Down Expand Up @@ -2107,7 +2107,7 @@ void VisualizationCapabilitiesPrivate::ViewTransparent(const Entity &_entity)
}

// Find all existing child links for this entity
std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
std::vector<Entity> links = this->FindChildLinks(_entity);

for (const auto &link : links)
{
Expand Down Expand Up @@ -2286,7 +2286,7 @@ void VisualizationCapabilitiesPrivate::FindInertialLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand All @@ -2310,7 +2310,7 @@ void VisualizationCapabilitiesPrivate::FindInertialLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand Down Expand Up @@ -2342,7 +2342,7 @@ void VisualizationCapabilitiesPrivate::FindCollisionLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand Down Expand Up @@ -2372,7 +2372,7 @@ void VisualizationCapabilitiesPrivate::PopulateViewModeVisualLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand All @@ -2397,7 +2397,7 @@ void VisualizationCapabilitiesPrivate::PopulateViewModeVisualLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand Down
20 changes: 10 additions & 10 deletions src/rendering/RenderUtil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ void RenderUtilPrivate::FindInertialLinks(const EntityComponentManager &_ecm)
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand All @@ -853,7 +853,7 @@ void RenderUtilPrivate::FindInertialLinks(const EntityComponentManager &_ecm)
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand Down Expand Up @@ -931,7 +931,7 @@ void RenderUtilPrivate::PopulateViewModeVisualLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand All @@ -956,7 +956,7 @@ void RenderUtilPrivate::PopulateViewModeVisualLinks(
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand Down Expand Up @@ -988,7 +988,7 @@ void RenderUtilPrivate::FindCollisionLinks(const EntityComponentManager &_ecm)
_ecm.EntityMatches(entity,
std::set<ComponentTypeId>{components::Link::typeId}))
{
links = std::move(this->FindChildLinksFromECM(_ecm, entity));
links = this->FindChildLinksFromECM(_ecm, entity);
}
else
{
Expand Down Expand Up @@ -3138,7 +3138,7 @@ void RenderUtil::HideWireboxes(const Entity &_entity)
/////////////////////////////////////////////////
void RenderUtil::ViewInertia(const Entity &_entity)
{
std::vector<Entity> inertiaLinks = std::move(this->FindChildLinks(_entity));
std::vector<Entity> inertiaLinks = this->FindChildLinks(_entity);

// check if _entity has an inertial component (_entity is a link)
if (this->dataPtr->entityInertials.find(_entity) !=
Expand Down Expand Up @@ -3197,7 +3197,7 @@ void RenderUtil::ViewInertia(const Entity &_entity)
/////////////////////////////////////////////////
void RenderUtil::ViewCOM(const Entity &_entity)
{
std::vector<Entity> inertiaLinks = std::move(this->FindChildLinks(_entity));
std::vector<Entity> inertiaLinks = this->FindChildLinks(_entity);

// check if _entity has an inertial component (_entity is a link)
if (this->dataPtr->entityInertials.find(_entity) !=
Expand Down Expand Up @@ -3351,7 +3351,7 @@ void RenderUtil::ViewTransparent(const Entity &_entity)
}

// Find all existing child links for this entity
std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
std::vector<Entity> links = this->FindChildLinks(_entity);

for (const auto &link : links)
{
Expand Down Expand Up @@ -3423,7 +3423,7 @@ void RenderUtil::ViewWireframes(const Entity &_entity)
}

// Find all existing child links for this entity
std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
std::vector<Entity> links = this->FindChildLinks(_entity);

for (const auto &link : links)
{
Expand Down Expand Up @@ -3493,7 +3493,7 @@ void RenderUtil::ViewCollisions(const Entity &_entity)
}

// Find all existing child links for this entity
std::vector<Entity> links = std::move(this->FindChildLinks(_entity));
std::vector<Entity> links = this->FindChildLinks(_entity);

for (const auto &link : links)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace systems
/// \brief A plugin that exports a world to a mesh.
/// When loaded the plugin will dump a mesh containing all the models in
/// the world to the current directory.
class ColladaWorldExporter:
class ColladaWorldExporter final:
public System,
public ISystemPostUpdate
{
Expand Down
2 changes: 1 addition & 1 deletion src/systems/contact/Contact.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace systems
**/
/// \brief Contact sensor system which manages all contact sensors in
/// simulation
class Contact :
class Contact final:
public System,
public ISystemPreUpdate,
public ISystemPostUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ namespace systems
</plugin>
</model>
\endverbatim */
class KineticEnergyMonitor :
class KineticEnergyMonitor final:
public System,
public ISystemConfigure,
public ISystemPostUpdate
Expand Down
2 changes: 1 addition & 1 deletion src/systems/log_video_recorder/LogVideoRecorder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace systems
/// When recording is finished. An `end` string will be published to the
/// `/log_video_recorder/status` topic and the videos are saved to a
/// timestamped directory
class LogVideoRecorder:
class LogVideoRecorder final:
public System,
public ISystemConfigure,
public ISystemPostUpdate
Expand Down
4 changes: 2 additions & 2 deletions src/systems/particle_emitter/ParticleEmitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void ParticleEmitter::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
// hack to avoid breaking the particle_emitter.proto message.
if (_emitter->Data().has_header())
{
for (const auto data : _emitter->Data().header().data())
for (const auto & data : _emitter->Data().header().data())
{
if (data.key() == "topic" && !data.value().empty())
{
Expand Down Expand Up @@ -218,7 +218,7 @@ void ParticleEmitter::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
return;

// Process each command
for (const auto cmd : this->dataPtr->userCmd)
for (const auto & cmd : this->dataPtr->userCmd)
{
// Create component.
auto emitterComp = _ecm.Component<components::ParticleEmitterCmd>(
Expand Down
4 changes: 2 additions & 2 deletions src/systems/particle_emitter2/ParticleEmitter2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void ParticleEmitter2::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
// hack to avoid breaking the particle_emitter.proto message.
if (_emitter->Data().has_header())
{
for (const auto data : _emitter->Data().header().data())
for (const auto & data : _emitter->Data().header().data())
{
if (data.key() == "topic" && !data.value().empty())
{
Expand Down Expand Up @@ -218,7 +218,7 @@ void ParticleEmitter2::PreUpdate(const ignition::gazebo::UpdateInfo &_info,
return;

// Process each command
for (const auto cmd : this->dataPtr->userCmd)
for (const auto & cmd : this->dataPtr->userCmd)
{
// Create component.
auto emitterComp = _ecm.Component<components::ParticleEmitterCmd>(
Expand Down
2 changes: 1 addition & 1 deletion src/systems/scene_broadcaster/SceneBroadcaster.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace systems
**/
/// \brief System which periodically publishes an ignition::msgs::Scene
/// message with updated information.
class SceneBroadcaster:
class SceneBroadcaster final:
public System,
public ISystemConfigure,
public ISystemPostUpdate
Expand Down
2 changes: 0 additions & 2 deletions src/systems/thruster/Thruster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,6 @@ void Thruster::PreUpdate(

ignition::gazebo::Link link(this->dataPtr->linkEntity);

auto pose = worldPose(this->dataPtr->linkEntity, _ecm);

// TODO(arjo129): add logic for custom coordinate frame
// Convert joint axis to the world frame
const auto linkWorldPose = worldPose(this->dataPtr->linkEntity, _ecm);
Expand Down
2 changes: 1 addition & 1 deletion src/systems/user_commands/UserCommands.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace systems
/// * **Response type*: ignition.msgs.Boolean
///
/// Try some examples described on examples/worlds/empty.sdf
class UserCommands:
class UserCommands final:
public System,
public ISystemConfigure,
public ISystemPreUpdate
Expand Down
2 changes: 1 addition & 1 deletion src/systems/wind_effects/WindEffects.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace systems
/// - `<vertical><noise>`
/// Parameters for the noise that is added to the vertical wind velocity
/// magnitude.
class WindEffects:
class WindEffects final:
public System,
public ISystemConfigure,
public ISystemPreUpdate
Expand Down
1 change: 0 additions & 1 deletion test/integration/breadcrumbs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ TEST_F(BreadcrumbsTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(PerformerSetVolume))
const std::size_t iterTestStart = 1000;
const std::size_t nIters = iterTestStart + 2000;

std::optional<math::Pose3d> initialPose;
testSystem.OnPostUpdate([&](const gazebo::UpdateInfo &_info,
const gazebo::EntityComponentManager &_ecm)
{
Expand Down
1 change: 0 additions & 1 deletion test/integration/log_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,6 @@ TEST_F(LogSystemTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogPlaybackStatistics))
Server server(config);

test::Relay testSystem;
math::Pose3d spherePose;
std::chrono::steady_clock::time_point startTime;
std::chrono::steady_clock::time_point endTime;
testSystem.OnPostUpdate(
Expand Down
1 change: 0 additions & 1 deletion test/integration/pose_publisher_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,6 @@ TEST_F(PosePublisherTest,
ASSERT_LT(0, msg.header().data(1).value_size());
std::string childFrameId = msg.header().data(1).value(0);
EXPECT_EQ(expectedEntityName, childFrameId);
math::Pose3d pose;
auto p = msgs::Convert(poseMsgs[0]);
EXPECT_EQ(expectedEntityPose, p);
}
Expand Down