Skip to content

Commit 2f9323d

Browse files
author
Ralf W. Grosse-Kunstleve
committed
resolve gcc warnings (based on patches by Scott Howlett)
[SVN r32284]
1 parent 8b2f4b4 commit 2f9323d

File tree

8 files changed

+87
-30
lines changed

8 files changed

+87
-30
lines changed

include/boost/python/detail/wrapper_base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace detail
7979
w->m_self = self;
8080
}
8181

82-
inline void initialize_wrapper(PyObject* self, ...) {}
82+
inline void initialize_wrapper(PyObject* /*self*/, ...) {}
8383

8484

8585

include/boost/python/object/iterator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ namespace detail
177177
inline object make_iterator_function(
178178
Accessor1 const& get_start
179179
, Accessor2 const& get_finish
180-
, NextPolicies const& next_policies
180+
, NextPolicies const& /*next_policies*/
181181
, Iterator const& (*)()
182182
, boost::type<Target>*
183183
, int

include/boost/python/object/value_holder.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct value_holder_back_reference : instance_holder
8686
# undef BOOST_PYTHON_UNFORWARD_LOCAL
8787

8888
template <class Value>
89-
void* value_holder<Value>::holds(type_info dst_t, bool null_ptr_only)
89+
void* value_holder<Value>::holds(type_info dst_t, bool /*null_ptr_only*/)
9090
{
9191
if (void* wrapped = holds_wrapped(dst_t, boost::addressof(m_held), boost::addressof(m_held)))
9292
return wrapped;
@@ -98,7 +98,7 @@ void* value_holder<Value>::holds(type_info dst_t, bool null_ptr_only)
9898

9999
template <class Value, class Held>
100100
void* value_holder_back_reference<Value,Held>::holds(
101-
type_info dst_t, bool null_ptr_only)
101+
type_info dst_t, bool /*null_ptr_only*/)
102102
{
103103
type_info src_t = python::type_id<Value>();
104104
Value* x = &m_held;

include/boost/python/with_custodian_and_ward.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ struct with_custodian_and_ward_postcall : BasePolicy_
8484
static PyObject* postcall(ArgumentPackage const& args_, PyObject* result)
8585
{
8686
std::size_t arity_ = detail::arity(args_);
87-
if ( custodian > arity_ || ward > arity_ )
87+
// check if either custodian or ward exceeds the arity
88+
// (this weird formulation avoids "always false" warnings
89+
// for arity_ = 0)
90+
if ( std::max(custodian, ward) > arity_ )
8891
{
8992
PyErr_SetString(
9093
PyExc_IndexError

src/object/class.cpp

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ extern "C"
6969
} propertyobject;
7070

7171
static PyObject *
72-
static_data_descr_get(PyObject *self, PyObject *obj, PyObject * /*type*/)
72+
static_data_descr_get(PyObject *self, PyObject * /*obj*/, PyObject * /*type*/)
7373
{
7474
propertyobject *gs = (propertyobject *)self;
7575

7676
return PyObject_CallFunction(gs->prop_get, "()");
7777
}
7878

7979
static int
80-
static_data_descr_set(PyObject *self, PyObject *obj, PyObject *value)
80+
static_data_descr_set(PyObject *self, PyObject * /*obj*/, PyObject *value)
8181
{
8282
propertyobject *gs = (propertyobject *)self;
8383
PyObject *func, *res;
@@ -147,6 +147,14 @@ static PyTypeObject static_data_object = {
147147
0, // filled in with type_new /* tp_new */
148148
0, // filled in with __PyObject_GC_Del /* tp_free */
149149
(inquiry)type_is_gc, /* tp_is_gc */
150+
0, /* tp_bases */
151+
0, /* tp_mro */
152+
0, /* tp_cache */
153+
0, /* tp_subclasses */
154+
0, /* tp_weaklist */
155+
#if PYTHON_API_VERSION >= 1012
156+
0 /* tp_del */
157+
#endif
150158
};
151159

152160
namespace objects
@@ -243,6 +251,14 @@ static PyTypeObject class_metatype_object = {
243251
0, // filled in with type_new /* tp_new */
244252
0, // filled in with __PyObject_GC_Del /* tp_free */
245253
(inquiry)type_is_gc, /* tp_is_gc */
254+
0, /* tp_bases */
255+
0, /* tp_mro */
256+
0, /* tp_cache */
257+
0, /* tp_subclasses */
258+
0, /* tp_weaklist */
259+
#if PYTHON_API_VERSION >= 1012
260+
0 /* tp_del */
261+
#endif
246262
};
247263

248264
// Install the instance data for a C++ object into a Python instance
@@ -295,7 +311,7 @@ namespace objects
295311
}
296312

297313
static PyObject *
298-
instance_new(PyTypeObject* type_, PyObject* args, PyObject *kw)
314+
instance_new(PyTypeObject* type_, PyObject* /*args*/, PyObject* /*kw*/)
299315
{
300316
// Attempt to find the __instance_size__ attribute. If not present, no problem.
301317
PyObject* d = type_->tp_dict;
@@ -340,14 +356,14 @@ namespace objects
340356

341357

342358
static PyGetSetDef instance_getsets[] = {
343-
{"__dict__", instance_get_dict, instance_set_dict, NULL},
344-
{0}
359+
{"__dict__", instance_get_dict, instance_set_dict, NULL, 0},
360+
{0, 0, 0, 0, 0}
345361
};
346362

347363

348364
static PyMemberDef instance_members[] = {
349-
{"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0},
350-
{0}
365+
{"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0, 0},
366+
{0, 0, 0, 0, 0}
351367
};
352368

353369
static PyTypeObject class_type_object = {
@@ -390,7 +406,17 @@ namespace objects
390406
offsetof(instance<>,dict), /* tp_dictoffset */
391407
0, /* tp_init */
392408
PyType_GenericAlloc, /* tp_alloc */
393-
instance_new /* tp_new */
409+
instance_new, /* tp_new */
410+
0, /* tp_free */
411+
0, /* tp_is_gc */
412+
0, /* tp_bases */
413+
0, /* tp_mro */
414+
0, /* tp_cache */
415+
0, /* tp_subclasses */
416+
0, /* tp_weaklist */
417+
#if PYTHON_API_VERSION >= 1012
418+
0 /* tp_del */
419+
#endif
394420
};
395421

396422
BOOST_PYTHON_DECL type_handle class_type()

src/object/enum.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ struct enum_object
2525
};
2626

2727
static PyMemberDef enum_members[] = {
28-
{"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY},
29-
{0}
28+
{"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0},
29+
{0, 0, 0, 0, 0}
3030
};
3131

3232

@@ -122,7 +122,17 @@ static PyTypeObject enum_type_object = {
122122
0, /* tp_dictoffset */
123123
0, /* tp_init */
124124
0, /* tp_alloc */
125-
0 /* tp_new */
125+
0, /* tp_new */
126+
0, /* tp_free */
127+
0, /* tp_is_gc */
128+
0, /* tp_bases */
129+
0, /* tp_mro */
130+
0, /* tp_cache */
131+
0, /* tp_subclasses */
132+
0, /* tp_weaklist */
133+
#if PYTHON_API_VERSION >= 1012
134+
0 /* tp_del */
135+
#endif
126136
};
127137

128138
object module_prefix();

src/object/function.cpp

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ PyObject* function::call(PyObject* args, PyObject* keywords) const
228228
return 0;
229229
}
230230

231-
void function::argument_error(PyObject* args, PyObject* keywords) const
231+
void function::argument_error(PyObject* args, PyObject* /*keywords*/) const
232232
{
233233
static handle<> exception(
234234
PyErr_NewException("Boost.Python.ArgumentError", PyExc_TypeError, 0));
@@ -580,19 +580,19 @@ extern "C"
580580
// We add a dummy __class__ attribute in order to fool PyDoc into
581581
// treating these as built-in functions and scanning their
582582
// documentation
583-
static PyObject* function_get_class(PyObject* op, void*)
583+
static PyObject* function_get_class(PyObject* /*op*/, void*)
584584
{
585585
return python::incref(upcast<PyObject>(&PyCFunction_Type));
586586
}
587587
}
588-
588+
589589
static PyGetSetDef function_getsetlist[] = {
590-
{"__name__", (getter)function_get_name, 0 },
591-
{"func_name", (getter)function_get_name, 0 },
592-
{"__class__", (getter)function_get_class, 0 }, // see note above
593-
{"__doc__", (getter)function_get_doc, (setter)function_set_doc},
594-
{"func_doc", (getter)function_get_doc, (setter)function_set_doc},
595-
{NULL} /* Sentinel */
590+
{"__name__", (getter)function_get_name, 0, 0, 0 },
591+
{"func_name", (getter)function_get_name, 0, 0, 0 },
592+
{"__class__", (getter)function_get_class, 0, 0, 0 }, // see note above
593+
{"__doc__", (getter)function_get_doc, (setter)function_set_doc, 0, 0},
594+
{"func_doc", (getter)function_get_doc, (setter)function_set_doc, 0, 0},
595+
{NULL, 0, 0, 0, 0} /* Sentinel */
596596
};
597597

598598
PyTypeObject function_type = {
@@ -634,8 +634,17 @@ PyTypeObject function_type = {
634634
0, //offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */
635635
0, /* tp_init */
636636
0, /* tp_alloc */
637-
0,
638-
0 /* tp_new */
637+
0, /* tp_new */
638+
0, /* tp_free */
639+
0, /* tp_is_gc */
640+
0, /* tp_bases */
641+
0, /* tp_mro */
642+
0, /* tp_cache */
643+
0, /* tp_subclasses */
644+
0, /* tp_weaklist */
645+
#if PYTHON_API_VERSION >= 1012
646+
0 /* tp_del */
647+
#endif
639648
};
640649

641650
object function_object(

src/object/life_support.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern "C"
2424
}
2525

2626
static PyObject *
27-
life_support_call(PyObject *self, PyObject *arg, PyObject *kw)
27+
life_support_call(PyObject *self, PyObject *arg, PyObject * /*kw*/)
2828
{
2929
// Let the patient die now
3030
Py_XDECREF(((life_support*)self)->patient);
@@ -74,8 +74,17 @@ PyTypeObject life_support_type = {
7474
0, //offsetof(PyLife_SupportObject, func_dict), /* tp_dictoffset */
7575
0, /* tp_init */
7676
0, /* tp_alloc */
77-
0,
78-
0 /* tp_new */
77+
0, /* tp_new */
78+
0, /* tp_free */
79+
0, /* tp_is_gc */
80+
0, /* tp_bases */
81+
0, /* tp_mro */
82+
0, /* tp_cache */
83+
0, /* tp_subclasses */
84+
0, /* tp_weaklist */
85+
#if PYTHON_API_VERSION >= 1012
86+
0 /* tp_del */
87+
#endif
7988
};
8089

8190
PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient)

0 commit comments

Comments
 (0)