Skip to content

Commit

Permalink
Fix errors with recent compilers and C++17/20 standard (#394)
Browse files Browse the repository at this point in the history
- fix definition of OcTreeBase(double res) constructor (it fixes gcc12/C++20 compilation errors)
- more robust detection of C++11 for Visual Studio (it fixes Visual Studio2022/C++17 compilation errors)
- remove several illegal semicolon (unlikely the reason of compilation errors, but it's neater to fix that)
  • Loading branch information
SpaceIm authored May 23, 2023
1 parent 5a54ff4 commit 8178b4f
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion octomap/include/octomap/AbstractOcTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace octomap {
friend class StaticMapInit;
public:
AbstractOcTree();
virtual ~AbstractOcTree() {};
virtual ~AbstractOcTree() {}

/// virtual constructor: creates a new object of same type
virtual AbstractOcTree* create() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion octomap/include/octomap/AbstractOccupancyOcTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace octomap {
class AbstractOccupancyOcTree : public AbstractOcTree {
public:
AbstractOccupancyOcTree();
virtual ~AbstractOccupancyOcTree() {};
virtual ~AbstractOccupancyOcTree() {}

//-- IO

Expand Down
2 changes: 1 addition & 1 deletion octomap/include/octomap/ColorOcTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ namespace octomap {
* StaticMemberInitializer, causing this tree failing to register.
* Needs to be called from the constructor of this octree.
*/
void ensureLinking() {};
void ensureLinking() {}
};
/// static member to ensure static initialization (only once)
static StaticMemberInitializer colorOcTreeMemberInit;
Expand Down
2 changes: 1 addition & 1 deletion octomap/include/octomap/CountingOcTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace octomap {
* StaticMemberInitializer, causing this tree failing to register.
* Needs to be called from the constructor of this octree.
*/
void ensureLinking() {};
void ensureLinking() {}
};
/// static member to ensure static initialization (only once)
static StaticMemberInitializer countingOcTreeMemberInit;
Expand Down
4 changes: 2 additions & 2 deletions octomap/include/octomap/OcTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace octomap {
*/
OcTree(std::string _filename);

virtual ~OcTree(){};
virtual ~OcTree(){}

/// virtual constructor: creates a new object of same type
/// (Covariant return type requires an up-to-date compiler)
Expand Down Expand Up @@ -89,7 +89,7 @@ namespace octomap {
* StaticMemberInitializer, causing this tree failing to register.
* Needs to be called from the constructor of this octree.
*/
void ensureLinking() {};
void ensureLinking() {}
};

/// to ensure static initialization (only once)
Expand Down
2 changes: 1 addition & 1 deletion octomap/include/octomap/OcTreeBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace octomap {
template <class NODE>
class OcTreeBase : public OcTreeBaseImpl<NODE,AbstractOcTree> {
public:
OcTreeBase<NODE>(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {};
OcTreeBase(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {}

/// virtual constructor: creates a new object of same type
/// (Covariant return type requires an up-to-date compiler)
Expand Down
8 changes: 4 additions & 4 deletions octomap/include/octomap/OcTreeBaseImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ namespace octomap {
virtual size_t memoryUsage() const;

/// \return Memory usage of a single octree node
virtual inline size_t memoryUsageNode() const {return sizeof(NODE); };
virtual inline size_t memoryUsageNode() const {return sizeof(NODE); }

/// \return Memory usage of a full grid of the same size as the OcTree in bytes (for comparison)
/// \note this can be larger than the adressable memory - size_t may not be enough to hold it!
Expand Down Expand Up @@ -324,12 +324,12 @@ namespace octomap {
typedef leaf_iterator iterator;

/// @return beginning of the tree as leaf iterator
iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);};
iterator begin(unsigned char maxDepth=0) const {return iterator(this, maxDepth);}
/// @return end of the tree as leaf iterator
const iterator end() const {return leaf_iterator_end;}; // TODO: RVE?
const iterator end() const {return leaf_iterator_end;} // TODO: RVE?

/// @return beginning of the tree as leaf iterator
leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);};
leaf_iterator begin_leafs(unsigned char maxDepth=0) const {return leaf_iterator(this, maxDepth);}
/// @return end of the tree as leaf iterator
const leaf_iterator end_leafs() const {return leaf_iterator_end;}

Expand Down
4 changes: 2 additions & 2 deletions octomap/include/octomap/OcTreeDataNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ namespace octomap {
OCTOMAP_DEPRECATED(bool hasChildren() const);

/// @return value stored in the node
T getValue() const{return value;};
T getValue() const{return value;}
/// sets value to be stored in the node
void setValue(T v) {value = v;};
void setValue(T v) {value = v;}

// file IO:

Expand Down
10 changes: 5 additions & 5 deletions octomap/include/octomap/OcTreeIterator.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
maxDepth = other.maxDepth;
stack = other.stack;
return *this;
};
}

/// Ptr operator will return the current node in the octree which the
/// iterator is referring to
Expand Down Expand Up @@ -220,7 +220,7 @@
* @param ptree OcTreeBaseImpl on which the iterator is used on
* @param depth Maximum depth to traverse the tree. 0 (default): unlimited
*/
tree_iterator(OcTreeBaseImpl<NodeType,INTERFACE> const* ptree, uint8_t depth=0) : iterator_base<NodeType>(ptree, depth) {};
tree_iterator(OcTreeBaseImpl<NodeType,INTERFACE> const* ptree, uint8_t depth=0) : iterator_base<NodeType>(ptree, depth) {}

/// postfix increment operator of iterator (it++)
tree_iterator operator++(int){
Expand Down Expand Up @@ -287,7 +287,7 @@
}
}

leaf_iterator(const leaf_iterator& other) : iterator_base<NodeType>(other) {};
leaf_iterator(const leaf_iterator& other) : iterator_base<NodeType>(other) {}

/// postfix increment operator of iterator (it++)
leaf_iterator operator++(int){
Expand Down Expand Up @@ -341,7 +341,7 @@
*/
class leaf_bbx_iterator : public iterator_base<NodeType> {
public:
leaf_bbx_iterator() : iterator_base<NodeType>() {};
leaf_bbx_iterator() : iterator_base<NodeType>() {}
/**
* Constructor of the iterator. The bounding box corners min and max are
* converted into an OcTreeKey first.
Expand Down Expand Up @@ -432,7 +432,7 @@


return *this;
};
}

protected:

Expand Down
2 changes: 1 addition & 1 deletion octomap/include/octomap/OcTreeStamped.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace octomap {
* StaticMemberInitializer, causing this tree failing to register.
* Needs to be called from the constructor of this octree.
*/
void ensureLinking() {};
void ensureLinking() {}
};
/// to ensure static initialization (only once)
static StaticMemberInitializer ocTreeStampedMemberInit;
Expand Down
2 changes: 1 addition & 1 deletion octomap/include/octomap/ScanGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace octomap {

public:

ScanGraph() {};
ScanGraph() {}
~ScanGraph();

/// Clears all nodes and edges, and will delete the corresponding objects
Expand Down
4 changes: 2 additions & 2 deletions octomap/src/Pointcloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

#if defined(_MSC_VER) || defined(_LIBCPP_VERSION)
#include <algorithm>
#if __cplusplus > 199711L
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
#include <random>
#endif
#else
Expand Down Expand Up @@ -213,7 +213,7 @@ namespace octomap {
#if defined(_MSC_VER) || defined(_LIBCPP_VERSION)
samples.reserve(this->size());
samples.insert(samples.end(), this->begin(), this->end());
#if __cplusplus > 199711L
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
std::random_device r;
std::mt19937 urbg(r());
std::shuffle(samples.begin(), samples.end(), urbg);
Expand Down
2 changes: 1 addition & 1 deletion octomap/src/compare_octrees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int main(int argc, char** argv) {
else
kld +=log(p1/p2)*p1 + log((1-p1)/(1-p2))*(1-p1);

#if __cplusplus >= 201103L
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
if (std::isnan(kld)){
#else
if (isnan(kld)){
Expand Down
10 changes: 5 additions & 5 deletions octovis/include/octovis/OcTreeDrawer.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ namespace octomap {
void setAlternativeDrawing(bool flag){m_alternativeDrawing = flag;}

void enableOcTree(bool enabled = true);
void enableOcTreeCells(bool enabled = true) { m_update = true; m_drawOccupied = enabled; };
void enableFreespace(bool enabled = true) { m_update = true; m_drawFree = enabled; };
void enableSelection(bool enabled = true) { m_update = true; m_drawSelection = enabled; };
void setMax_tree_depth(unsigned int max_tree_depth) { m_update = true; m_max_tree_depth = max_tree_depth;};
void enableOcTreeCells(bool enabled = true) { m_update = true; m_drawOccupied = enabled; }
void enableFreespace(bool enabled = true) { m_update = true; m_drawFree = enabled; }
void enableSelection(bool enabled = true) { m_update = true; m_drawSelection = enabled; }
void setMax_tree_depth(unsigned int max_tree_depth) { m_update = true; m_max_tree_depth = max_tree_depth;}

// set new origin (move object)
void setOrigin(octomap::pose6d t);
void enableAxes(bool enabled = true) { m_update = true; m_displayAxes = enabled; };
void enableAxes(bool enabled = true) { m_update = true; m_displayAxes = enabled; }

protected:
//void clearOcTree();
Expand Down
8 changes: 4 additions & 4 deletions octovis/include/octovis/SceneObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace octomap {

public:
SceneObject();
virtual ~SceneObject(){};
virtual ~SceneObject(){}

/**
* Actual draw function which will be called to visualize the object
Expand All @@ -67,7 +67,7 @@ namespace octomap {
/**
* Clears the object's representation (will be called when it gets invalid)
*/
virtual void clear(){};
virtual void clear(){}

public:
//! the color mode has to be set before calling OcTreDrawer::setMap()
Expand Down Expand Up @@ -95,8 +95,8 @@ namespace octomap {
*/
class ScanGraphDrawer : public SceneObject {
public:
ScanGraphDrawer(): SceneObject(){};
virtual ~ScanGraphDrawer(){};
ScanGraphDrawer(): SceneObject(){}
virtual ~ScanGraphDrawer(){}

/**
* Notifies drawer of a new or changed ScanGraph, so that the internal
Expand Down
12 changes: 6 additions & 6 deletions octovis/include/octovis/ViewerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class ViewerSettings : public QDialog
public:
ViewerSettings(QWidget *parent = 0);
~ViewerSettings();
double getResolution(){return ui.resolution->value(); };
void setResolution(double resolution){ui.resolution->setValue(resolution);};
unsigned int getLaserType(){return ui.laserType->currentIndex(); };
void setLaserType(int type){ui.laserType->setCurrentIndex(type); };
double getMaxRange(){return ui.maxRange->value(); };
void setMaxRange(double range){ui.maxRange->setValue(range); };
double getResolution(){return ui.resolution->value(); }
void setResolution(double resolution){ui.resolution->setValue(resolution);}
unsigned int getLaserType(){return ui.laserType->currentIndex(); }
void setLaserType(int type){ui.laserType->setCurrentIndex(type); }
double getMaxRange(){return ui.maxRange->value(); }
void setMaxRange(double range){ui.maxRange->setValue(range); }

private:
Ui::ViewerSettingsClass ui;
Expand Down
8 changes: 4 additions & 4 deletions octovis/src/extern/QGLViewer/VRender/Exporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace vrender
{
public:
Exporter() ;
virtual ~Exporter() {};
virtual ~Exporter() {}

virtual void exportToFile(const QString& filename,const std::vector<PtrPrimitive>&,VRenderParams&) ;

Expand Down Expand Up @@ -92,7 +92,7 @@ namespace vrender
{
public:
EPSExporter() ;
virtual ~EPSExporter() {};
virtual ~EPSExporter() {}

protected:
virtual void spewPoint(const Point *, QTextStream& out) ;
Expand Down Expand Up @@ -120,7 +120,7 @@ namespace vrender
class PSExporter: public EPSExporter
{
public:
virtual ~PSExporter() {};
virtual ~PSExporter() {}
protected:
virtual void writeFooter(QTextStream& out) const ;
};
Expand All @@ -129,7 +129,7 @@ namespace vrender
{
public:
FIGExporter() ;
virtual ~FIGExporter() {};
virtual ~FIGExporter() {}

protected:
virtual void spewPoint(const Point *, QTextStream& out) ;
Expand Down
4 changes: 2 additions & 2 deletions octovis/src/extern/QGLViewer/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ void Camera::setScreenWidthAndHeight(int width, int height)
\code
class myCamera :: public qglviewer::Camera
{
virtual qreal Camera::zNear() const { return 0.001; };
virtual qreal Camera::zFar() const { return 100.0; };
virtual qreal Camera::zNear() const { return 0.001; }
virtual qreal Camera::zFar() const { return 100.0; }
}
\endcode
Expand Down
Loading

0 comments on commit 8178b4f

Please sign in to comment.