Skip to content

Commit 8178b4f

Browse files
authored
Fix errors with recent compilers and C++17/20 standard (#394)
- 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)
1 parent 5a54ff4 commit 8178b4f

19 files changed

+56
-56
lines changed

Diff for: octomap/include/octomap/AbstractOcTree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace octomap {
5151
friend class StaticMapInit;
5252
public:
5353
AbstractOcTree();
54-
virtual ~AbstractOcTree() {};
54+
virtual ~AbstractOcTree() {}
5555

5656
/// virtual constructor: creates a new object of same type
5757
virtual AbstractOcTree* create() const = 0;

Diff for: octomap/include/octomap/AbstractOccupancyOcTree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace octomap {
5252
class AbstractOccupancyOcTree : public AbstractOcTree {
5353
public:
5454
AbstractOccupancyOcTree();
55-
virtual ~AbstractOccupancyOcTree() {};
55+
virtual ~AbstractOccupancyOcTree() {}
5656

5757
//-- IO
5858

Diff for: octomap/include/octomap/ColorOcTree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ namespace octomap {
192192
* StaticMemberInitializer, causing this tree failing to register.
193193
* Needs to be called from the constructor of this octree.
194194
*/
195-
void ensureLinking() {};
195+
void ensureLinking() {}
196196
};
197197
/// static member to ensure static initialization (only once)
198198
static StaticMemberInitializer colorOcTreeMemberInit;

Diff for: octomap/include/octomap/CountingOcTree.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ namespace octomap {
110110
* StaticMemberInitializer, causing this tree failing to register.
111111
* Needs to be called from the constructor of this octree.
112112
*/
113-
void ensureLinking() {};
113+
void ensureLinking() {}
114114
};
115115
/// static member to ensure static initialization (only once)
116116
static StaticMemberInitializer countingOcTreeMemberInit;

Diff for: octomap/include/octomap/OcTree.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace octomap {
5959
*/
6060
OcTree(std::string _filename);
6161

62-
virtual ~OcTree(){};
62+
virtual ~OcTree(){}
6363

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

9595
/// to ensure static initialization (only once)

Diff for: octomap/include/octomap/OcTreeBase.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace octomap {
4343
template <class NODE>
4444
class OcTreeBase : public OcTreeBaseImpl<NODE,AbstractOcTree> {
4545
public:
46-
OcTreeBase<NODE>(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {};
46+
OcTreeBase(double res) : OcTreeBaseImpl<NODE,AbstractOcTree>(res) {}
4747

4848
/// virtual constructor: creates a new object of same type
4949
/// (Covariant return type requires an up-to-date compiler)

Diff for: octomap/include/octomap/OcTreeBaseImpl.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ namespace octomap {
244244
virtual size_t memoryUsage() const;
245245

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

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

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

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

Diff for: octomap/include/octomap/OcTreeDataNode.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ namespace octomap {
100100
OCTOMAP_DEPRECATED(bool hasChildren() const);
101101

102102
/// @return value stored in the node
103-
T getValue() const{return value;};
103+
T getValue() const{return value;}
104104
/// sets value to be stored in the node
105-
void setValue(T v) {value = v;};
105+
void setValue(T v) {value = v;}
106106

107107
// file IO:
108108

Diff for: octomap/include/octomap/OcTreeIterator.hxx

+5-5
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
maxDepth = other.maxDepth;
103103
stack = other.stack;
104104
return *this;
105-
};
105+
}
106106

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

225225
/// postfix increment operator of iterator (it++)
226226
tree_iterator operator++(int){
@@ -287,7 +287,7 @@
287287
}
288288
}
289289

290-
leaf_iterator(const leaf_iterator& other) : iterator_base<NodeType>(other) {};
290+
leaf_iterator(const leaf_iterator& other) : iterator_base<NodeType>(other) {}
291291

292292
/// postfix increment operator of iterator (it++)
293293
leaf_iterator operator++(int){
@@ -341,7 +341,7 @@
341341
*/
342342
class leaf_bbx_iterator : public iterator_base<NodeType> {
343343
public:
344-
leaf_bbx_iterator() : iterator_base<NodeType>() {};
344+
leaf_bbx_iterator() : iterator_base<NodeType>() {}
345345
/**
346346
* Constructor of the iterator. The bounding box corners min and max are
347347
* converted into an OcTreeKey first.
@@ -432,7 +432,7 @@
432432

433433

434434
return *this;
435-
};
435+
}
436436

437437
protected:
438438

Diff for: octomap/include/octomap/OcTreeStamped.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ namespace octomap {
116116
* StaticMemberInitializer, causing this tree failing to register.
117117
* Needs to be called from the constructor of this octree.
118118
*/
119-
void ensureLinking() {};
119+
void ensureLinking() {}
120120
};
121121
/// to ensure static initialization (only once)
122122
static StaticMemberInitializer ocTreeStampedMemberInit;

Diff for: octomap/include/octomap/ScanGraph.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ namespace octomap {
115115

116116
public:
117117

118-
ScanGraph() {};
118+
ScanGraph() {}
119119
~ScanGraph();
120120

121121
/// Clears all nodes and edges, and will delete the corresponding objects

Diff for: octomap/src/Pointcloud.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#if defined(_MSC_VER) || defined(_LIBCPP_VERSION)
4040
#include <algorithm>
41-
#if __cplusplus > 199711L
41+
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
4242
#include <random>
4343
#endif
4444
#else
@@ -213,7 +213,7 @@ namespace octomap {
213213
#if defined(_MSC_VER) || defined(_LIBCPP_VERSION)
214214
samples.reserve(this->size());
215215
samples.insert(samples.end(), this->begin(), this->end());
216-
#if __cplusplus > 199711L
216+
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
217217
std::random_device r;
218218
std::mt19937 urbg(r());
219219
std::shuffle(samples.begin(), samples.end(), urbg);

Diff for: octomap/src/compare_octrees.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ int main(int argc, char** argv) {
132132
else
133133
kld +=log(p1/p2)*p1 + log((1-p1)/(1-p2))*(1-p1);
134134

135-
#if __cplusplus >= 201103L
135+
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
136136
if (std::isnan(kld)){
137137
#else
138138
if (isnan(kld)){

Diff for: octovis/include/octovis/OcTreeDrawer.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ namespace octomap {
6262
void setAlternativeDrawing(bool flag){m_alternativeDrawing = flag;}
6363

6464
void enableOcTree(bool enabled = true);
65-
void enableOcTreeCells(bool enabled = true) { m_update = true; m_drawOccupied = enabled; };
66-
void enableFreespace(bool enabled = true) { m_update = true; m_drawFree = enabled; };
67-
void enableSelection(bool enabled = true) { m_update = true; m_drawSelection = enabled; };
68-
void setMax_tree_depth(unsigned int max_tree_depth) { m_update = true; m_max_tree_depth = max_tree_depth;};
65+
void enableOcTreeCells(bool enabled = true) { m_update = true; m_drawOccupied = enabled; }
66+
void enableFreespace(bool enabled = true) { m_update = true; m_drawFree = enabled; }
67+
void enableSelection(bool enabled = true) { m_update = true; m_drawSelection = enabled; }
68+
void setMax_tree_depth(unsigned int max_tree_depth) { m_update = true; m_max_tree_depth = max_tree_depth;}
6969

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

7474
protected:
7575
//void clearOcTree();

Diff for: octovis/include/octovis/SceneObject.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace octomap {
5757

5858
public:
5959
SceneObject();
60-
virtual ~SceneObject(){};
60+
virtual ~SceneObject(){}
6161

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

7272
public:
7373
//! the color mode has to be set before calling OcTreDrawer::setMap()
@@ -95,8 +95,8 @@ namespace octomap {
9595
*/
9696
class ScanGraphDrawer : public SceneObject {
9797
public:
98-
ScanGraphDrawer(): SceneObject(){};
99-
virtual ~ScanGraphDrawer(){};
98+
ScanGraphDrawer(): SceneObject(){}
99+
virtual ~ScanGraphDrawer(){}
100100

101101
/**
102102
* Notifies drawer of a new or changed ScanGraph, so that the internal

Diff for: octovis/include/octovis/ViewerSettings.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ class ViewerSettings : public QDialog
4040
public:
4141
ViewerSettings(QWidget *parent = 0);
4242
~ViewerSettings();
43-
double getResolution(){return ui.resolution->value(); };
44-
void setResolution(double resolution){ui.resolution->setValue(resolution);};
45-
unsigned int getLaserType(){return ui.laserType->currentIndex(); };
46-
void setLaserType(int type){ui.laserType->setCurrentIndex(type); };
47-
double getMaxRange(){return ui.maxRange->value(); };
48-
void setMaxRange(double range){ui.maxRange->setValue(range); };
43+
double getResolution(){return ui.resolution->value(); }
44+
void setResolution(double resolution){ui.resolution->setValue(resolution);}
45+
unsigned int getLaserType(){return ui.laserType->currentIndex(); }
46+
void setLaserType(int type){ui.laserType->setCurrentIndex(type); }
47+
double getMaxRange(){return ui.maxRange->value(); }
48+
void setMaxRange(double range){ui.maxRange->setValue(range); }
4949

5050
private:
5151
Ui::ViewerSettingsClass ui;

Diff for: octovis/src/extern/QGLViewer/VRender/Exporter.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace vrender
6060
{
6161
public:
6262
Exporter() ;
63-
virtual ~Exporter() {};
63+
virtual ~Exporter() {}
6464

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

@@ -92,7 +92,7 @@ namespace vrender
9292
{
9393
public:
9494
EPSExporter() ;
95-
virtual ~EPSExporter() {};
95+
virtual ~EPSExporter() {}
9696

9797
protected:
9898
virtual void spewPoint(const Point *, QTextStream& out) ;
@@ -120,7 +120,7 @@ namespace vrender
120120
class PSExporter: public EPSExporter
121121
{
122122
public:
123-
virtual ~PSExporter() {};
123+
virtual ~PSExporter() {}
124124
protected:
125125
virtual void writeFooter(QTextStream& out) const ;
126126
};
@@ -129,7 +129,7 @@ namespace vrender
129129
{
130130
public:
131131
FIGExporter() ;
132-
virtual ~FIGExporter() {};
132+
virtual ~FIGExporter() {}
133133

134134
protected:
135135
virtual void spewPoint(const Point *, QTextStream& out) ;

Diff for: octovis/src/extern/QGLViewer/camera.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ void Camera::setScreenWidthAndHeight(int width, int height)
199199
\code
200200
class myCamera :: public qglviewer::Camera
201201
{
202-
virtual qreal Camera::zNear() const { return 0.001; };
203-
virtual qreal Camera::zFar() const { return 100.0; };
202+
virtual qreal Camera::zNear() const { return 0.001; }
203+
virtual qreal Camera::zFar() const { return 100.0; }
204204
}
205205
\endcode
206206

0 commit comments

Comments
 (0)