diff --git a/include/boost/python/detail/wrapper_base.hpp b/include/boost/python/detail/wrapper_base.hpp index 658db5d9..99a5d7a5 100755 --- a/include/boost/python/detail/wrapper_base.hpp +++ b/include/boost/python/detail/wrapper_base.hpp @@ -79,7 +79,7 @@ namespace detail w->m_self = self; } - inline void initialize_wrapper(PyObject* self, ...) {} + inline void initialize_wrapper(PyObject* /*self*/, ...) {} diff --git a/include/boost/python/object/iterator.hpp b/include/boost/python/object/iterator.hpp index 7b9810ec..3e24afd2 100644 --- a/include/boost/python/object/iterator.hpp +++ b/include/boost/python/object/iterator.hpp @@ -177,7 +177,7 @@ namespace detail inline object make_iterator_function( Accessor1 const& get_start , Accessor2 const& get_finish - , NextPolicies const& next_policies + , NextPolicies const& /*next_policies*/ , Iterator const& (*)() , boost::type* , int diff --git a/include/boost/python/object/value_holder.hpp b/include/boost/python/object/value_holder.hpp index 85bd74dc..e53866a1 100644 --- a/include/boost/python/object/value_holder.hpp +++ b/include/boost/python/object/value_holder.hpp @@ -86,7 +86,7 @@ private: // required holder implementation # undef BOOST_PYTHON_UNFORWARD_LOCAL template -void* value_holder::holds(type_info dst_t, bool null_ptr_only) +void* value_holder::holds(type_info dst_t, bool /*null_ptr_only*/) { if (void* wrapped = holds_wrapped(dst_t, boost::addressof(m_held), boost::addressof(m_held))) return wrapped; @@ -98,7 +98,7 @@ void* value_holder::holds(type_info dst_t, bool null_ptr_only) template void* value_holder_back_reference::holds( - type_info dst_t, bool null_ptr_only) + type_info dst_t, bool /*null_ptr_only*/) { type_info src_t = python::type_id(); Value* x = &m_held; diff --git a/include/boost/python/with_custodian_and_ward.hpp b/include/boost/python/with_custodian_and_ward.hpp index 4117b215..cb44cf04 100644 --- a/include/boost/python/with_custodian_and_ward.hpp +++ b/include/boost/python/with_custodian_and_ward.hpp @@ -84,7 +84,10 @@ struct with_custodian_and_ward_postcall : BasePolicy_ static PyObject* postcall(ArgumentPackage const& args_, PyObject* result) { std::size_t arity_ = detail::arity(args_); - if ( custodian > arity_ || ward > arity_ ) + // check if either custodian or ward exceeds the arity + // (this weird formulation avoids "always false" warnings + // for arity_ = 0) + if ( std::max(custodian, ward) > arity_ ) { PyErr_SetString( PyExc_IndexError diff --git a/src/object/class.cpp b/src/object/class.cpp index 68642abc..efc492c6 100644 --- a/src/object/class.cpp +++ b/src/object/class.cpp @@ -69,7 +69,7 @@ extern "C" } propertyobject; static PyObject * - static_data_descr_get(PyObject *self, PyObject *obj, PyObject * /*type*/) + static_data_descr_get(PyObject *self, PyObject * /*obj*/, PyObject * /*type*/) { propertyobject *gs = (propertyobject *)self; @@ -77,7 +77,7 @@ extern "C" } static int - static_data_descr_set(PyObject *self, PyObject *obj, PyObject *value) + static_data_descr_set(PyObject *self, PyObject * /*obj*/, PyObject *value) { propertyobject *gs = (propertyobject *)self; PyObject *func, *res; @@ -147,6 +147,14 @@ static PyTypeObject static_data_object = { 0, // filled in with type_new /* tp_new */ 0, // filled in with __PyObject_GC_Del /* tp_free */ (inquiry)type_is_gc, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PYTHON_API_VERSION >= 1012 + 0 /* tp_del */ +#endif }; namespace objects @@ -243,6 +251,14 @@ static PyTypeObject class_metatype_object = { 0, // filled in with type_new /* tp_new */ 0, // filled in with __PyObject_GC_Del /* tp_free */ (inquiry)type_is_gc, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PYTHON_API_VERSION >= 1012 + 0 /* tp_del */ +#endif }; // Install the instance data for a C++ object into a Python instance @@ -295,7 +311,7 @@ namespace objects } static PyObject * - instance_new(PyTypeObject* type_, PyObject* args, PyObject *kw) + instance_new(PyTypeObject* type_, PyObject* /*args*/, PyObject* /*kw*/) { // Attempt to find the __instance_size__ attribute. If not present, no problem. PyObject* d = type_->tp_dict; @@ -340,14 +356,14 @@ namespace objects static PyGetSetDef instance_getsets[] = { - {"__dict__", instance_get_dict, instance_set_dict, NULL}, - {0} + {"__dict__", instance_get_dict, instance_set_dict, NULL, 0}, + {0, 0, 0, 0, 0} }; static PyMemberDef instance_members[] = { - {"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0}, - {0} + {"__weakref__", T_OBJECT, offsetof(instance<>, weakrefs), 0, 0}, + {0, 0, 0, 0, 0} }; static PyTypeObject class_type_object = { @@ -390,7 +406,17 @@ namespace objects offsetof(instance<>,dict), /* tp_dictoffset */ 0, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ - instance_new /* tp_new */ + instance_new, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PYTHON_API_VERSION >= 1012 + 0 /* tp_del */ +#endif }; BOOST_PYTHON_DECL type_handle class_type() diff --git a/src/object/enum.cpp b/src/object/enum.cpp index 433dfdb1..e319bd08 100644 --- a/src/object/enum.cpp +++ b/src/object/enum.cpp @@ -25,8 +25,8 @@ struct enum_object }; static PyMemberDef enum_members[] = { - {"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY}, - {0} + {"name", T_OBJECT_EX, offsetof(enum_object,name),READONLY, 0}, + {0, 0, 0, 0, 0} }; @@ -122,7 +122,17 @@ static PyTypeObject enum_type_object = { 0, /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ - 0 /* tp_new */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PYTHON_API_VERSION >= 1012 + 0 /* tp_del */ +#endif }; object module_prefix(); diff --git a/src/object/function.cpp b/src/object/function.cpp index baedbda7..ac46000f 100644 --- a/src/object/function.cpp +++ b/src/object/function.cpp @@ -228,7 +228,7 @@ PyObject* function::call(PyObject* args, PyObject* keywords) const return 0; } -void function::argument_error(PyObject* args, PyObject* keywords) const +void function::argument_error(PyObject* args, PyObject* /*keywords*/) const { static handle<> exception( PyErr_NewException("Boost.Python.ArgumentError", PyExc_TypeError, 0)); @@ -580,19 +580,19 @@ extern "C" // We add a dummy __class__ attribute in order to fool PyDoc into // treating these as built-in functions and scanning their // documentation - static PyObject* function_get_class(PyObject* op, void*) + static PyObject* function_get_class(PyObject* /*op*/, void*) { return python::incref(upcast(&PyCFunction_Type)); } } - + static PyGetSetDef function_getsetlist[] = { - {"__name__", (getter)function_get_name, 0 }, - {"func_name", (getter)function_get_name, 0 }, - {"__class__", (getter)function_get_class, 0 }, // see note above - {"__doc__", (getter)function_get_doc, (setter)function_set_doc}, - {"func_doc", (getter)function_get_doc, (setter)function_set_doc}, - {NULL} /* Sentinel */ + {"__name__", (getter)function_get_name, 0, 0, 0 }, + {"func_name", (getter)function_get_name, 0, 0, 0 }, + {"__class__", (getter)function_get_class, 0, 0, 0 }, // see note above + {"__doc__", (getter)function_get_doc, (setter)function_set_doc, 0, 0}, + {"func_doc", (getter)function_get_doc, (setter)function_set_doc, 0, 0}, + {NULL, 0, 0, 0, 0} /* Sentinel */ }; PyTypeObject function_type = { @@ -634,8 +634,17 @@ PyTypeObject function_type = { 0, //offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ - 0, - 0 /* tp_new */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PYTHON_API_VERSION >= 1012 + 0 /* tp_del */ +#endif }; object function_object( diff --git a/src/object/life_support.cpp b/src/object/life_support.cpp index f4bc7b80..a1768cba 100644 --- a/src/object/life_support.cpp +++ b/src/object/life_support.cpp @@ -24,7 +24,7 @@ extern "C" } static PyObject * - life_support_call(PyObject *self, PyObject *arg, PyObject *kw) + life_support_call(PyObject *self, PyObject *arg, PyObject * /*kw*/) { // Let the patient die now Py_XDECREF(((life_support*)self)->patient); @@ -74,8 +74,17 @@ PyTypeObject life_support_type = { 0, //offsetof(PyLife_SupportObject, func_dict), /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ - 0, - 0 /* tp_new */ + 0, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ +#if PYTHON_API_VERSION >= 1012 + 0 /* tp_del */ +#endif }; PyObject* make_nurse_and_patient(PyObject* nurse, PyObject* patient)