Skip to content

Commit eaab622

Browse files
committed
Eliminate warnings
1 parent 89e39c5 commit eaab622

12 files changed

Lines changed: 23 additions & 119 deletions

include/details/property_list.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class property_list {
215215
/// return keys in order of insertion
216216
/// param[in] helper, buffer optionally to be used
217217
/// return reference to key storage
218-
const key_list_type &get_keys(key_list_type &helper) {
218+
const key_list_type &get_keys(key_list_type &/* helper */) {
219219
if (dirty_keys_)
220220
purge_keys();
221221
return keys_;

include/xnode.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ template <typename T>
110110
class xnode_deleter<T, xstNull>
111111
{
112112
public:
113-
static void destroy(void *ptr)
113+
static void destroy(void * /* ptr */)
114114
{
115115
// empty
116116
}
@@ -125,7 +125,7 @@ template <typename T>
125125
class xnode_deleter<T, xstPointer>
126126
{
127127
public:
128-
static void destroy(void *ptr)
128+
static void destroy(void * /* ptr */)
129129
{
130130
// empty
131131
}
@@ -140,7 +140,7 @@ template <typename T>
140140
class xnode_deleter<T, xstCasted>
141141
{
142142
public:
143-
static void destroy(void *ptr)
143+
static void destroy(void * /* ptr */)
144144
{
145145
// empty
146146
}
@@ -176,7 +176,7 @@ class xnode_setter
176176
}
177177

178178
// copy value to already existing object using assign operator
179-
static void copy(void *dest, const void *src)
179+
static void copy(void * /* dest */, const void * /* src */)
180180
{
181181
// empty
182182
}
@@ -203,7 +203,7 @@ class xnode_setter
203203
}
204204

205205
// copy from another node using assign operator, assume old value holds pointer to existing object
206-
static void copy_from_node(void *dest, const void *src)
206+
static void copy_from_node(void * /* dest */, const void * /* src */)
207207
{
208208
// empty
209209
}
@@ -218,12 +218,12 @@ class xnode_setter<T, xstNull>
218218
return false;
219219
}
220220

221-
static void copy(void *dest, const void *src)
221+
static void copy(void * /* dest */, const void * /* src */)
222222
{
223223
// empty
224224
}
225225

226-
static void assign_from_value(void **dest, const void *src)
226+
static void assign_from_value(void **dest, const void * /* src */)
227227
{
228228
*dest = nullptr;
229229
}
@@ -239,7 +239,7 @@ class xnode_setter<T, xstNull>
239239
*dest = const_cast<void *>(src);
240240
}
241241

242-
static void copy_from_node(void *dest, const void *src)
242+
static void copy_from_node(void * /* dest */, const void * /* src */)
243243
{
244244
// empty
245245
}
@@ -255,7 +255,7 @@ class xnode_setter<T, xstCasted>
255255
}
256256

257257
// copy value
258-
static void copy(void *dest, const void *src)
258+
static void copy(void * /* dest */, const void * /* src */)
259259
{
260260
// empty
261261
}
@@ -280,7 +280,7 @@ class xnode_setter<T, xstCasted>
280280
*dest = const_cast<void *>(src);
281281
}
282282

283-
static void copy_from_node(void *dest, const void *src)
283+
static void copy_from_node(void * /* dest */, const void * /* src */)
284284
{
285285
// empty
286286
}
@@ -296,7 +296,7 @@ class xnode_setter<T, xstPointer>
296296
}
297297

298298
// copy value
299-
static void copy(void *dest, const void *src)
299+
static void copy(void * /* dest */, const void * /* src */)
300300
{
301301
// empty
302302
}
@@ -318,7 +318,7 @@ class xnode_setter<T, xstPointer>
318318
*dest = const_cast<void *>(src);
319319
}
320320

321-
static void copy_from_node(void *dest, const void *src)
321+
static void copy_from_node(void * /* dest */, const void * /* src */)
322322
{
323323
// empty
324324
}
@@ -397,12 +397,12 @@ class xnode_getter
397397
}
398398

399399
// returns pointer to stored value
400-
static void *value_ptr(void **src)
400+
static void *value_ptr(void ** /* src */)
401401
{
402402
return nullptr;
403403
}
404404

405-
static void read_value(void *dest, void **src)
405+
static void read_value(void * /* dest */, void ** /* src */)
406406
{
407407
// empty
408408
}

include/xnode_long_double.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ class xnode_caster<double, xnode_ld_cast_policy> : xnode_caster_base {
3636
typedef double ValueType;
3737

3838
static bool cast_to_value(ValueType &output, void **storage, int srcTypeCode) {
39-
bool result = true;
40-
4139
// Special handling for long double
4240
if (srcTypeCode == xnode_type_code<long double>::value) {
4341
long double value;

include/xnode_type_ext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ template<typename ValueType, typename CastPolicy>
6060
class xnode_caster {
6161
public:
6262

63-
static bool cast_to_value(ValueType &output, void *storage, int srcTypeCode) {
63+
static bool cast_to_value(ValueType & /* output */, void * /* storage */, int /* srcTypeCode */) {
6464
return false;
6565
}
6666

67-
static bool cast_from_value(void **storage, int destTypeCode, const ValueType &value) {
67+
static bool cast_from_value(void ** /* storage */, int /* destTypeCode */, const ValueType & /* value */) {
6868
return false;
6969
}
7070
};

include/xnode_utils.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,13 @@ struct xn_is_pointer { static const bool value = false; };
7171
template<typename T>
7272
struct xn_is_pointer<T*> { static const bool value = true; };
7373

74-
// from SO, red Jun 30 '11 at 14:17, iammilind
75-
namespace XN_CHECK_EQUALS // namespace to let "operator ==" not become global
74+
namespace XN_CHECK_EQUALS
7675
{
77-
typedef char no[7];
78-
template<typename T> no& operator == (const T&, const T&);
76+
template <typename T, typename = void>
77+
struct opEqualExists : std::false_type {};
7978

8079
template <typename T>
81-
struct opEqualExists // *(T*)(0) can be replaced by *new T[1] also
82-
{
83-
enum { value = (sizeof(*(T*)(0) == *(T*)(0)) != sizeof(no)) };
84-
};
80+
struct opEqualExists<T, decltype(void(std::declval<T>() == std::declval<T>()))> : std::true_type {};
8581
}
8682

8783
namespace XN_CHECK_LESS
@@ -121,7 +117,7 @@ template<class T>
121117
typename xnEnableIf<
122118
xnSelector<
123119
!has_equals_operator<T>::value>, bool>::type
124-
xn_equals(const T& lhs, const T& rhs)
120+
xn_equals(const T& /* lhs */, const T& /* rhs */)
125121
{
126122
throw std::runtime_error(std::string("Equals not implemented, type: ") + typeid(T).name());
127123
}
@@ -141,7 +137,7 @@ template<class T>
141137
typename xnEnableIf<
142138
xnSelector<
143139
!has_less_operator<T>::value>, bool>::type
144-
xn_less(const T& lhs, const T& rhs)
140+
xn_less(const T& /* lhs */, const T& /* rhs */)
145141
{
146142
throw std::runtime_error(std::string("Less operator not implemented, type: ") + typeid(T).name());
147143
}

test/xarray_test.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66
// License: BSD
77
//----------------------------------------------------------------------------------
88

9-
// Disable warnings from template instantiations in header files
10-
#ifdef __GNUC__
11-
#pragma GCC diagnostic push
12-
#pragma GCC diagnostic ignored "-Wunused-parameter"
13-
#pragma GCC diagnostic ignored "-Wnonnull"
14-
#endif
15-
169
#include "xnode.h"
1710
#include "xarray.h"
1811
#include <iostream>
@@ -32,11 +25,6 @@
3225
#include "cunit.h"
3326
#include "xobject.h"
3427

35-
// Restore warnings after includes
36-
#ifdef __GNUC__
37-
#pragma GCC diagnostic pop
38-
#endif
39-
4028
using namespace std;
4129

4230
void TestArraySum() {

test/xnode_convert_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
// License: BSD
77
//----------------------------------------------------------------------------------
88

9-
// Disable warnings from template instantiations in header files
10-
#ifdef __GNUC__
11-
#pragma GCC diagnostic push
12-
#pragma GCC diagnostic ignored "-Wunused-parameter"
13-
#pragma GCC diagnostic ignored "-Wunused-variable"
14-
#pragma GCC diagnostic ignored "-Wnonnull"
15-
#endif
16-
179
#include "xnode.h"
1810
#include <iostream>
1911

@@ -26,11 +18,6 @@
2618
#include <limits>
2719
#include <cmath>
2820

29-
// Restore warnings after includes
30-
#ifdef __GNUC__
31-
#pragma GCC diagnostic pop
32-
#endif
33-
3421
using namespace std;
3522

3623
// Helper function to log the conversion being tested

test/xnode_overflow_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
// License: BSD
77
//----------------------------------------------------------------------------------
88

9-
// Disable warnings from template instantiations in header files
10-
#ifdef __GNUC__
11-
#pragma GCC diagnostic push
12-
#pragma GCC diagnostic ignored "-Wunused-parameter"
13-
#pragma GCC diagnostic ignored "-Wunused-variable"
14-
#pragma GCC diagnostic ignored "-Wnonnull"
15-
#endif
16-
179
#include "xnode.h"
1810
#include <iostream>
1911
#include <limits>
@@ -24,11 +16,6 @@
2416
#include "cunit.h"
2517
#include "xarray.h"
2618

27-
// Restore warnings after includes
28-
#ifdef __GNUC__
29-
#pragma GCC diagnostic pop
30-
#endif
31-
3219
using namespace std;
3320

3421
// Helper function to log the test being executed

test/xnode_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
// License: BSD
88
//----------------------------------------------------------------------------------
99

10-
// Disable warnings from template instantiations in header files
11-
#ifdef __GNUC__
12-
#pragma GCC diagnostic push
13-
#pragma GCC diagnostic ignored "-Wunused-parameter"
14-
#pragma GCC diagnostic ignored "-Wunused-variable"
15-
#pragma GCC diagnostic ignored "-Wnonnull"
16-
#endif
17-
1810
#include "xnode.h"
1911
#include <iostream>
2012

@@ -27,11 +19,6 @@
2719
#include "cunit.h"
2820
#include "xnode_long_double.h"
2921

30-
// Restore warnings after includes
31-
#ifdef __GNUC__
32-
#pragma GCC diagnostic pop
33-
#endif
34-
3522
using namespace std;
3623

3724
void TestDefCntr() {

test/xnode_tree_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
// License: BSD
77
//----------------------------------------------------------------------------------
88

9-
// Disable warnings from template instantiations in header files
10-
#ifdef __GNUC__
11-
#pragma GCC diagnostic push
12-
#pragma GCC diagnostic ignored "-Wunused-parameter"
13-
#pragma GCC diagnostic ignored "-Wunused-variable"
14-
#pragma GCC diagnostic ignored "-Wnonnull"
15-
#endif
16-
179
#include "xnode.h"
1810
#include "xarray.h"
1911
#include "xobject.h"
@@ -24,11 +16,6 @@
2416

2517
#include "cunit.h"
2618

27-
// Restore warnings after includes
28-
#ifdef __GNUC__
29-
#pragma GCC diagnostic pop
30-
#endif
31-
3219
using namespace std;
3320

3421
void TestTreeOfNodesWithArray() {

0 commit comments

Comments
 (0)