summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /pyuno
parenta85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff)
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/loader/pyuno_loader.cxx6
-rw-r--r--pyuno/source/module/pyuno.cxx52
-rw-r--r--pyuno/source/module/pyuno_callable.cxx4
-rw-r--r--pyuno/source/module/pyuno_iterator.cxx10
-rw-r--r--pyuno/source/module/pyuno_struct.cxx12
5 files changed, 42 insertions, 42 deletions
diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx
index 31b4f8f494f9..d1cbc9156dfc 100644
--- a/pyuno/source/loader/pyuno_loader.cxx
+++ b/pyuno/source/loader/pyuno_loader.cxx
@@ -106,12 +106,12 @@ static PyRef getObjectFromLoaderModule( const char * func )
return object;
}
-OUString getImplementationName()
+static OUString getImplementationName()
{
return OUString( "org.openoffice.comp.pyuno.Loader" );
}
-Sequence< OUString > getSupportedServiceNames()
+static Sequence< OUString > getSupportedServiceNames()
{
OUString serviceName( "com.sun.star.loader.Python" );
return Sequence< OUString > ( &serviceName, 1 );
@@ -238,7 +238,7 @@ PythonInit() {
}
};
-Reference<XInterface> CreateInstance(const Reference<XComponentContext> & ctx)
+static Reference<XInterface> CreateInstance(const Reference<XComponentContext> & ctx)
{
// tdf#114815 thread-safe static to init python only once
static PythonInit s_Init;
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index dc73a754609d..434888f59e6e 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -71,9 +71,9 @@ using com::sun::star::container::XNameReplace;
namespace pyuno
{
-PyObject *PyUNO_str( PyObject * self );
+static PyObject *PyUNO_str( PyObject * self );
-void PyUNO_del (PyObject* self)
+static void PyUNO_del (PyObject* self)
{
PyUNO* me = reinterpret_cast< PyUNO* > (self);
{
@@ -309,7 +309,7 @@ OUString val2str( const void * pVal, typelib_TypeDescriptionReference * pTypeRef
return buf.makeStringAndClear();
}
-sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
+static sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
{
// Check object is an index
PyRef rIndex( PyNumber_Index( pObj ), SAL_NO_ACQUIRE );
@@ -333,7 +333,7 @@ sal_Int32 lcl_PyNumber_AsSal_Int32( PyObject *pObj )
return nResult;
}
-int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 nLen, sal_Int32 *nStart, sal_Int32 *nStop, sal_Int32 *nStep, sal_Int32 *nSliceLength )
+static int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 nLen, sal_Int32 *nStart, sal_Int32 *nStop, sal_Int32 *nStep, sal_Int32 *nSliceLength )
{
Py_ssize_t nStart_ssize, nStop_ssize, nStep_ssize, nSliceLength_ssize;
@@ -363,7 +363,7 @@ int lcl_PySlice_GetIndicesEx( PyObject *pObject, sal_Int32 nLen, sal_Int32 *nSta
return 0;
}
-bool lcl_hasInterfaceByName( Any const &object, OUString const & interfaceName )
+static bool lcl_hasInterfaceByName( Any const &object, OUString const & interfaceName )
{
Reference< XInterface > xInterface( object, UNO_QUERY );
TypeDescription typeDesc( interfaceName );
@@ -372,12 +372,12 @@ bool lcl_hasInterfaceByName( Any const &object, OUString const & interfaceName )
return aInterface.hasValue();
}
-PyObject *PyUNO_repr( PyObject * self )
+static PyObject *PyUNO_repr( PyObject * self )
{
return PyUNO_str( self );
}
-Py_hash_t PyUNO_hash( PyObject *self )
+static Py_hash_t PyUNO_hash( PyObject *self )
{
PyUNO *me = reinterpret_cast<PyUNO *>(self);
@@ -476,7 +476,7 @@ PyObject *PyUNO_str( PyObject * self )
return PyStr_FromString( buf.getStr() );
}
-PyObject* PyUNO_dir (PyObject* self)
+static PyObject* PyUNO_dir (PyObject* self)
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
@@ -501,7 +501,7 @@ PyObject* PyUNO_dir (PyObject* self)
return member_list;
}
-sal_Int32 lcl_detach_getLength( PyUNO const *me )
+static sal_Int32 lcl_detach_getLength( PyUNO const *me )
{
PyThreadDetach antiguard;
@@ -527,7 +527,7 @@ sal_Int32 lcl_detach_getLength( PyUNO const *me )
return -1;
}
-int PyUNO_bool( PyObject* self )
+static int PyUNO_bool( PyObject* self )
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
@@ -548,7 +548,7 @@ int PyUNO_bool( PyObject* self )
return -1;
}
-Py_ssize_t PyUNO_len( PyObject* self )
+static Py_ssize_t PyUNO_len( PyObject* self )
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
@@ -568,7 +568,7 @@ Py_ssize_t PyUNO_len( PyObject* self )
return -1;
}
-void lcl_getRowsColumns( PyUNO const * me, sal_Int32& nRows, sal_Int32& nColumns )
+static void lcl_getRowsColumns( PyUNO const * me, sal_Int32& nRows, sal_Int32& nColumns )
{
Sequence<short> aOutParamIndex;
Sequence<Any> aOutParam;
@@ -583,7 +583,7 @@ void lcl_getRowsColumns( PyUNO const * me, sal_Int32& nRows, sal_Int32& nColumns
nColumns = xIndexAccessCols->getCount();
}
-PyRef lcl_indexToSlice( const PyRef& rIndex )
+static PyRef lcl_indexToSlice( const PyRef& rIndex )
{
Py_ssize_t nIndex = PyNumber_AsSsize_t( rIndex.get(), PyExc_IndexError );
if (nIndex == -1 && PyErr_Occurred())
@@ -596,7 +596,7 @@ PyRef lcl_indexToSlice( const PyRef& rIndex )
return rSlice;
}
-PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
+static PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
{
Runtime runtime;
@@ -717,7 +717,7 @@ PyObject* lcl_getitem_XCellRange( PyUNO const * me, PyObject* pKey )
return nullptr;
}
-PyObject* lcl_getitem_index( PyUNO const *me, PyObject *pKey, Runtime const & runtime )
+static PyObject* lcl_getitem_index( PyUNO const *me, PyObject *pKey, Runtime const & runtime )
{
Any aRet;
sal_Int32 nIndex;
@@ -746,7 +746,7 @@ PyObject* lcl_getitem_index( PyUNO const *me, PyObject *pKey, Runtime const & ru
return nullptr;
}
-PyObject* lcl_getitem_slice( PyUNO const *me, PyObject *pKey )
+static PyObject* lcl_getitem_slice( PyUNO const *me, PyObject *pKey )
{
Runtime runtime;
@@ -789,7 +789,7 @@ PyObject* lcl_getitem_slice( PyUNO const *me, PyObject *pKey )
return nullptr;
}
-PyObject* lcl_getitem_string( PyUNO const *me, PyObject *pKey, Runtime const & runtime )
+static PyObject* lcl_getitem_string( PyUNO const *me, PyObject *pKey, Runtime const & runtime )
{
OUString sKey = pyString2ustring( pKey );
Any aRet;
@@ -812,7 +812,7 @@ PyObject* lcl_getitem_string( PyUNO const *me, PyObject *pKey, Runtime const & r
return nullptr;
}
-PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
+static PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
Runtime runtime;
@@ -899,7 +899,7 @@ PyObject* PyUNO_getitem( PyObject *self, PyObject *pKey )
return nullptr;
}
-int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue )
+static int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue )
{
Runtime runtime;
@@ -967,7 +967,7 @@ int lcl_setitem_index( PyUNO const *me, PyObject *pKey, PyObject *pValue )
return 1;
}
-int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue )
+static int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue )
{
// XIndexContainer insert/remove/replace by slice
Runtime runtime;
@@ -1085,7 +1085,7 @@ int lcl_setitem_slice( PyUNO const *me, PyObject *pKey, PyObject *pValue )
return 1;
}
-int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue )
+static int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue )
{
Runtime runtime;
@@ -1157,7 +1157,7 @@ int lcl_setitem_string( PyUNO const *me, PyObject *pKey, PyObject *pValue )
return 1;
}
-int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue )
+static int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue )
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
@@ -1210,7 +1210,7 @@ int PyUNO_setitem( PyObject *self, PyObject *pKey, PyObject *pValue )
return 1;
}
-PyObject* PyUNO_iter( PyObject *self )
+static PyObject* PyUNO_iter( PyObject *self )
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
@@ -1286,7 +1286,7 @@ PyObject* PyUNO_iter( PyObject *self )
return nullptr;
}
-int PyUNO_contains( PyObject *self, PyObject *pKey )
+static int PyUNO_contains( PyObject *self, PyObject *pKey )
{
PyUNO* me = reinterpret_cast<PyUNO*>(self);
@@ -1375,7 +1375,7 @@ int PyUNO_contains( PyObject *self, PyObject *pKey )
return -1;
}
-PyObject* PyUNO_getattr (PyObject* self, char* name)
+static PyObject* PyUNO_getattr (PyObject* self, char* name)
{
PyUNO* me;
@@ -1455,7 +1455,7 @@ PyObject* PyUNO_getattr (PyObject* self, char* name)
return nullptr;
}
-int PyUNO_setattr (PyObject* self, char* name, PyObject* value)
+static int PyUNO_setattr (PyObject* self, char* name, PyObject* value)
{
PyUNO* me;
diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx
index 2075fc7e372f..4269b09b21e3 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -43,7 +43,7 @@ typedef struct
PyUNO_callable_Internals* members;
} PyUNO_callable;
-void PyUNO_callable_del (PyObject* self)
+static void PyUNO_callable_del (PyObject* self)
{
PyUNO_callable* me;
@@ -52,7 +52,7 @@ void PyUNO_callable_del (PyObject* self)
PyObject_Del (self);
}
-PyObject* PyUNO_callable_call(
+static PyObject* PyUNO_callable_call(
PyObject* self, PyObject* args, SAL_UNUSED_PARAMETER PyObject*)
{
PyUNO_callable* me;
diff --git a/pyuno/source/module/pyuno_iterator.cxx b/pyuno/source/module/pyuno_iterator.cxx
index 5a36a32d516d..5847d881a90e 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -40,7 +40,7 @@ using com::sun::star::uno::RuntimeException;
namespace pyuno
{
-void PyUNO_iterator_del( PyObject* self )
+static void PyUNO_iterator_del( PyObject* self )
{
PyUNO_iterator* me = reinterpret_cast<PyUNO_iterator*>(self);
@@ -51,13 +51,13 @@ void PyUNO_iterator_del( PyObject* self )
PyObject_Del( self );
}
-PyObject* PyUNO_iterator_iter( PyObject *self )
+static PyObject* PyUNO_iterator_iter( PyObject *self )
{
Py_INCREF( self );
return self;
}
-PyObject* PyUNO_iterator_next( PyObject *self )
+static PyObject* PyUNO_iterator_next( PyObject *self )
{
PyUNO_iterator* me = reinterpret_cast<PyUNO_iterator*>(self);
@@ -178,7 +178,7 @@ PyObject* PyUNO_iterator_new( const Reference< XEnumeration >& xEnumeration )
///////////////////////////////////////////////////////////////////////////////
-void PyUNO_list_iterator_del( PyObject* self )
+static void PyUNO_list_iterator_del( PyObject* self )
{
PyUNO_list_iterator* me = reinterpret_cast<PyUNO_list_iterator*>(self);
@@ -190,7 +190,7 @@ void PyUNO_list_iterator_del( PyObject* self )
}
-PyObject* PyUNO_list_iterator_next( PyObject *self )
+static PyObject* PyUNO_list_iterator_next( PyObject *self )
{
PyUNO_list_iterator* me = reinterpret_cast<PyUNO_list_iterator*>(self);
diff --git a/pyuno/source/module/pyuno_struct.cxx b/pyuno/source/module/pyuno_struct.cxx
index 2fbb81350387..35eab1d0ed9e 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -47,7 +47,7 @@ using com::sun::star::beans::XMaterialHolder;
namespace pyuno
{
-void PyUNOStruct_del( PyObject* self )
+static void PyUNOStruct_del( PyObject* self )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
{
@@ -57,7 +57,7 @@ void PyUNOStruct_del( PyObject* self )
PyObject_Del( self );
}
-PyObject *PyUNOStruct_str( PyObject *self )
+static PyObject *PyUNOStruct_str( PyObject *self )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
OStringBuffer buf;
@@ -74,7 +74,7 @@ PyObject *PyUNOStruct_str( PyObject *self )
return PyStr_FromString( buf.getStr());
}
-PyObject *PyUNOStruct_repr( PyObject *self )
+static PyObject *PyUNOStruct_repr( PyObject *self )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
PyObject *ret = nullptr;
@@ -99,7 +99,7 @@ PyObject *PyUNOStruct_repr( PyObject *self )
return ret;
}
-PyObject* PyUNOStruct_dir( PyObject *self )
+static PyObject* PyUNOStruct_dir( PyObject *self )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
@@ -122,7 +122,7 @@ PyObject* PyUNOStruct_dir( PyObject *self )
return member_list;
}
-PyObject* PyUNOStruct_getattr( PyObject* self, char* name )
+static PyObject* PyUNOStruct_getattr( PyObject* self, char* name )
{
PyUNO *me = reinterpret_cast<PyUNO*>( self );
@@ -188,7 +188,7 @@ PyObject* PyUNOStruct_getattr( PyObject* self, char* name )
return nullptr;
}
-int PyUNOStruct_setattr (PyObject* self, char* name, PyObject* value)
+static int PyUNOStruct_setattr (PyObject* self, char* name, PyObject* value)
{
PyUNO* me;