Skip to content

Commit

Permalink
fix (or silence) warnings of newer gcc / clang
Browse files Browse the repository at this point in the history
-Wdeprecated-copy
-Wclass-memaccess
-Woverloaded-virtual
  • Loading branch information
rhaschke committed May 13, 2020
1 parent ebfbb1f commit 25f377d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/rviz/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ Config::Config() : node_(new Config::Node())
{
}

Config::Config(const Config& source) : node_(source.node_)
{
}

Config::Config(const QVariant& value) : node_(new Config::Node())
{
setValue(value);
Expand Down
2 changes: 1 addition & 1 deletion src/rviz/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Config
/** @brief Default constructor. Creates an empty config object. */
Config();
/** @brief Copy constructor. Copies only the reference to the data, not the data itself. */
Config(const Config& source);
Config(const Config& source) = default;
/** @brief Convenience constructor, makes a Value type Config object with the given value. */
Config(const QVariant& value);

Expand Down
7 changes: 7 additions & 0 deletions src/rviz/ogre_helpers/point_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,14 @@ void PointCloud::addPoints(Point* points, uint32_t num_points)
}

Point* begin = &points_.front() + point_count_;
#if defined(__GNUC__) && (__GNUC__ >= 8)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#endif
memcpy(begin, points, sizeof(Point) * num_points);
#if defined(__GNUC__) && (__GNUC__ >= 8)
#pragma GCC diagnostic pop
#endif

uint32_t vpp = getVerticesPerPoint();
Ogre::RenderOperation::OperationType op_type;
Expand Down
2 changes: 2 additions & 0 deletions src/rviz/ogre_helpers/point_cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class PointCloudRenderable : public Ogre::SimpleRenderable
PointCloudRenderable(PointCloud* parent, int num_points, bool use_tex_coords);
~PointCloudRenderable() override;

using Ogre::SimpleRenderable::getRenderOperation;

Ogre::RenderOperation* getRenderOperation()
{
return &mRenderOp;
Expand Down
8 changes: 8 additions & 0 deletions src/rviz/properties/property_tree_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ class RVIZ_EXPORT PropertySelectionModel : public QItemSelectionModel
class RVIZ_EXPORT PropertyTreeWidget : public QTreeView
{
Q_OBJECT

public:
PropertyTreeWidget(QWidget* parent = nullptr);

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
/** @brief Set the data model this widget should view. */
void setModel(PropertyTreeModel* model);
#ifdef __clang__
#pragma clang diagnostic pop
#endif
PropertyTreeModel* getModel() const
{
return model_;
Expand Down
1 change: 1 addition & 0 deletions src/rviz/selection/selection_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ bool SelectionManager::render(Ogre::Viewport* viewport,
ros::WallTime end = ros::WallTime::now();
ros::WallDuration d = end - start;
// ROS_DEBUG("Render took [%f] msec", d.toSec() * 1000.0f);
Q_UNUSED(d);

Ogre::MaterialManager::getSingleton().removeListener(this);

Expand Down
2 changes: 1 addition & 1 deletion src/rviz/yaml_config_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void YamlConfigWriter::writeFile(const Config& config, const QString& filename)
message_ = "Failed to open " + filename + " for writing.";
}
}
catch (std::exception ex)
catch (const std::exception& ex)
{
error_ = true;
message_ = ex.what();
Expand Down

0 comments on commit 25f377d

Please sign in to comment.