2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-24 18:12:43 +00:00

resolve gcc warnings (based on patches by Scott Howlett)

[SVN r32284]
This commit is contained in:
Ralf W. Grosse-Kunstleve
2006-01-11 03:31:48 +00:00
parent 8b2f4b4ce0
commit 2f9323d9e9
8 changed files with 87 additions and 30 deletions

View File

@@ -79,7 +79,7 @@ namespace detail
w->m_self = self;
}
inline void initialize_wrapper(PyObject* self, ...) {}
inline void initialize_wrapper(PyObject* /*self*/, ...) {}

View File

@@ -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<Target>*
, int

View File

@@ -86,7 +86,7 @@ private: // required holder implementation
# undef BOOST_PYTHON_UNFORWARD_LOCAL
template <class Value>
void* value_holder<Value>::holds(type_info dst_t, bool null_ptr_only)
void* value_holder<Value>::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<Value>::holds(type_info dst_t, bool null_ptr_only)
template <class Value, class Held>
void* value_holder_back_reference<Value,Held>::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>();
Value* x = &m_held;

View File

@@ -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

View File

@@ -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()

View File

@@ -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();

View File

@@ -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<PyObject>(&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(

View File

@@ -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)