diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-01-21 15:21:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-01-21 15:21:16 +0100 |
commit | 7c704c78d3c652504c064b4ac7af55a2c1ee49bb (patch) | |
tree | 623358cf25839219ef4fd90eea4f3eaa55389a1f /pyuno | |
parent | 0d5167915b47df7c3e450614ea50d845ba959df3 (diff) |
Removed some unused parameters; added SAL_UNUSED_PARAMETER.
SAL_UNUSED_PARAMETER (expanding to __attribute__ ((unused)) for GCC)
is used to annotate legitimately unused parameters, so that static
analysis tools can tell legitimately unused parameters from truly
unnecessary ones. To that end, some patches for external modules
are also added, that are only applied when compiling with GCC and
add necessary __attribute__ ((unused)) in headers.
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/module/pyuno.cxx | 6 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_callable.cxx | 3 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_impl.hxx | 2 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_module.cxx | 39 | ||||
-rw-r--r-- | pyuno/source/module/pyuno_runtime.cxx | 2 |
5 files changed, 31 insertions, 21 deletions
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index fa7904b95542..ce58f9914ddc 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -340,7 +340,7 @@ PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args ) Runtime runtime; PyRef paras,callable; - if( PyObject_IsInstance( object, getPyUnoClass( runtime ).get() ) ) + if( PyObject_IsInstance( object, getPyUnoClass().get() ) ) { PyUNO* me = (PyUNO*) object; OUString attrName = OUString::createFromAscii(name); @@ -607,7 +607,7 @@ static PyObject* PyUNO_cmp( PyObject *self, PyObject *that, int op ) try { Runtime runtime; - if( PyObject_IsInstance( that, getPyUnoClass( runtime ).get() ) ) + if( PyObject_IsInstance( that, getPyUnoClass().get() ) ) { PyUNO *me = reinterpret_cast< PyUNO*> ( self ); @@ -697,7 +697,7 @@ static PyTypeObject PyUNOType = #endif }; -PyRef getPyUnoClass( const Runtime &) +PyRef getPyUnoClass() { return PyRef( reinterpret_cast< PyObject * > ( &PyUNOType ) ); } diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx index a4a5b12acfb1..004a49c93545 100644 --- a/pyuno/source/module/pyuno_callable.cxx +++ b/pyuno/source/module/pyuno_callable.cxx @@ -72,7 +72,8 @@ void PyUNO_callable_del (PyObject* self) return; } -PyObject* PyUNO_callable_call (PyObject* self, PyObject* args, PyObject*) +PyObject* PyUNO_callable_call( + PyObject* self, PyObject* args, SAL_UNUSED_PARAMETER PyObject*) { PyUNO_callable* me; diff --git a/pyuno/source/module/pyuno_impl.hxx b/pyuno/source/module/pyuno_impl.hxx index ff6ca8716e69..a4af5c2b2c38 100644 --- a/pyuno/source/module/pyuno_impl.hxx +++ b/pyuno/source/module/pyuno_impl.hxx @@ -213,7 +213,7 @@ PyRef getEnumClass( const Runtime &); PyRef getBoolClass( const Runtime &); PyRef getCharClass( const Runtime &); PyRef getByteSequenceClass( const Runtime & ); -PyRef getPyUnoClass( const Runtime &); +PyRef getPyUnoClass(); PyRef getClass( const rtl::OUString & name , const Runtime & runtime ); PyRef getAnyClass( const Runtime &); PyObject *PyUNO_invoke( PyObject *object, const char *name , PyObject *args ); diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx index 0382259f95b3..31c330ea03cc 100644 --- a/pyuno/source/module/pyuno_module.cxx +++ b/pyuno/source/module/pyuno_module.cxx @@ -253,7 +253,8 @@ void raisePySystemException( const char * exceptionType, const OUString & messag extern "C" { -static PyObject* getComponentContext (PyObject*, PyObject*) +static PyObject* getComponentContext( + SAL_UNUSED_PARAMETER PyObject*, SAL_UNUSED_PARAMETER PyObject*) { PyRef ret; try @@ -352,7 +353,8 @@ PyObject * extractOneStringArg( PyObject *args, char const *funcName ) return obj; } -static PyObject *createUnoStructHelper(PyObject *, PyObject* args, PyObject* keywordArgs) +static PyObject *createUnoStructHelper( + SAL_UNUSED_PARAMETER PyObject *, PyObject* args, PyObject* keywordArgs) { Any IdlStruct; PyRef ret; @@ -439,7 +441,8 @@ static PyObject *createUnoStructHelper(PyObject *, PyObject* args, PyObject* key return ret.getAcquired(); } -static PyObject *getTypeByName( PyObject *, PyObject *args ) +static PyObject *getTypeByName( + SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) { PyObject * ret = NULL; @@ -472,7 +475,8 @@ static PyObject *getTypeByName( PyObject *, PyObject *args ) return ret; } -static PyObject *getConstantByName( PyObject *, PyObject *args ) +static PyObject *getConstantByName( + SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) { PyObject *ret = 0; try @@ -520,7 +524,7 @@ static PyObject *getConstantByName( PyObject *, PyObject *args ) return ret; } -static PyObject *checkType( PyObject *, PyObject *args ) +static PyObject *checkType( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) { if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 ) { @@ -544,7 +548,7 @@ static PyObject *checkType( PyObject *, PyObject *args ) return Py_None; } -static PyObject *checkEnum( PyObject *, PyObject *args ) +static PyObject *checkEnum( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) { if( !PyTuple_Check( args ) || PyTuple_Size( args) != 1 ) { @@ -568,7 +572,7 @@ static PyObject *checkEnum( PyObject *, PyObject *args ) return Py_None; } -static PyObject *getClass( PyObject *, PyObject *args ) +static PyObject *getClass( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) { PyObject *obj = extractOneStringArg( args, "pyuno.getClass"); if( ! obj ) @@ -594,7 +598,7 @@ static PyObject *getClass( PyObject *, PyObject *args ) return NULL; } -static PyObject *isInterface( PyObject *, PyObject *args ) +static PyObject *isInterface( SAL_UNUSED_PARAMETER PyObject *, PyObject *args ) { if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) @@ -606,7 +610,8 @@ static PyObject *isInterface( PyObject *, PyObject *args ) return PyLong_FromLong( 0 ); } -static PyObject * generateUuid( PyObject *, PyObject * ) +static PyObject * generateUuid( + SAL_UNUSED_PARAMETER PyObject *, SAL_UNUSED_PARAMETER PyObject * ) { Sequence< sal_Int8 > seq( 16 ); rtl_createUuid( (sal_uInt8*)seq.getArray() , 0 , sal_False ); @@ -623,7 +628,8 @@ static PyObject * generateUuid( PyObject *, PyObject * ) return ret.getAcquired(); } -static PyObject *systemPathToFileUrl( PyObject *, PyObject * args ) +static PyObject *systemPathToFileUrl( + SAL_UNUSED_PARAMETER PyObject *, PyObject * args ) { PyObject *obj = extractOneStringArg( args, "pyuno.systemPathToFileUrl" ); if( ! obj ) @@ -648,7 +654,8 @@ static PyObject *systemPathToFileUrl( PyObject *, PyObject * args ) return ustring2PyUnicode( url ).getAcquired(); } -static PyObject * fileUrlToSystemPath( PyObject *, PyObject * args ) +static PyObject * fileUrlToSystemPath( + SAL_UNUSED_PARAMETER PyObject *, PyObject * args ) { PyObject *obj = extractOneStringArg( args, "pyuno.fileUrlToSystemPath" ); if( ! obj ) @@ -673,7 +680,7 @@ static PyObject * fileUrlToSystemPath( PyObject *, PyObject * args ) return ustring2PyUnicode( sysPath ).getAcquired(); } -static PyObject * absolutize( PyObject *, PyObject * args ) +static PyObject * absolutize( SAL_UNUSED_PARAMETER PyObject *, PyObject * args ) { if( PyTuple_Check( args ) && PyTuple_Size( args ) == 2 ) { @@ -702,7 +709,7 @@ static PyObject * absolutize( PyObject *, PyObject * args ) return 0; } -static PyObject * invoke(PyObject *, PyObject *args) +static PyObject * invoke(SAL_UNUSED_PARAMETER PyObject *, PyObject *args) { PyObject *ret = 0; if(PyTuple_Check(args) && PyTuple_Size(args) == 3) @@ -744,7 +751,8 @@ static PyObject * invoke(PyObject *, PyObject *args) return ret; } -static PyObject *getCurrentContext( PyObject *, PyObject * ) +static PyObject *getCurrentContext( + SAL_UNUSED_PARAMETER PyObject *, SAL_UNUSED_PARAMETER PyObject * ) { PyRef ret; try @@ -760,7 +768,8 @@ static PyObject *getCurrentContext( PyObject *, PyObject * ) return ret.getAcquired(); } -static PyObject *setCurrentContext( PyObject *, PyObject * args ) +static PyObject *setCurrentContext( + SAL_UNUSED_PARAMETER PyObject *, SAL_UNUSED_PARAMETER PyObject * args ) { PyRef ret; try diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx index 9dc5b5214419..f38dccd227c1 100644 --- a/pyuno/source/module/pyuno_runtime.cxx +++ b/pyuno/source/module/pyuno_runtime.cxx @@ -802,7 +802,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con Reference< XInterface > () ); } } - else if( PyObject_IsInstance( o, getPyUnoClass( runtime ).get() ) ) + else if( PyObject_IsInstance( o, getPyUnoClass().get() ) ) { PyUNO* o_pi; o_pi = (PyUNO*) o; |