summaryrefslogtreecommitdiff
path: root/scripting
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 /scripting
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 'scripting')
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx4
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx14
-rw-r--r--scripting/source/stringresource/stringresource.cxx20
-rw-r--r--scripting/source/vbaevents/eventhelper.cxx26
4 files changed, 32 insertions, 32 deletions
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 537499cbd0df..90a28cca56fd 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -76,7 +76,7 @@ namespace comp_DialogModelProvider
return s;
}
- uno::Reference< uno::XInterface > _create(const uno::Reference< uno::XComponentContext > & context)
+ static uno::Reference< uno::XInterface > _create(const uno::Reference< uno::XComponentContext > & context)
{
return static_cast< ::cppu::OWeakObject * >(new dlgprov::DialogModelProvider(context));
}
@@ -205,7 +205,7 @@ namespace dlgprov
}
- Reference< resource::XStringResourceManager > getStringResourceFromDialogLibrary
+ static Reference< resource::XStringResourceManager > getStringResourceFromDialogLibrary
( const Reference< container::XNameContainer >& xDialogLib )
{
Reference< resource::XStringResourceManager > xStringResourceManager;
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index d06833d7a6dd..56082753e864 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -56,7 +56,7 @@ using namespace ::sf_misc;
namespace func_provider
{
-bool endsWith( const OUString& target, const OUString& item )
+static bool endsWith( const OUString& target, const OUString& item )
{
sal_Int32 index = target.indexOf( item );
return index != -1 &&
@@ -709,14 +709,14 @@ Sequence< OUString > SAL_CALL MasterScriptProvider::getSupportedServiceNames( )
namespace scripting_runtimemgr
{
-Reference< XInterface > sp_create(
+static Reference< XInterface > sp_create(
const Reference< XComponentContext > & xCompC )
{
return static_cast<cppu::OWeakObject *>(new ::func_provider::MasterScriptProvider( xCompC ));
}
-Sequence< OUString > sp_getSupportedServiceNames( )
+static Sequence< OUString > sp_getSupportedServiceNames( )
{
OUString names[3];
@@ -728,20 +728,20 @@ Sequence< OUString > sp_getSupportedServiceNames( )
}
-OUString sp_getImplementationName( )
+static OUString sp_getImplementationName( )
{
return OUString( "com.sun.star.script.provider.MasterScriptProvider" );
}
// ***** registration or ScriptingFrameworkURIHelper
-Reference< XInterface > urihelper_create(
+static Reference< XInterface > urihelper_create(
const Reference< XComponentContext > & xCompC )
{
return static_cast<cppu::OWeakObject *>(
new ::func_provider::ScriptingFrameworkURIHelper( xCompC ));
}
-Sequence< OUString > urihelper_getSupportedServiceNames( )
+static Sequence< OUString > urihelper_getSupportedServiceNames( )
{
OUString serviceNameList[] = {
OUString(
@@ -753,7 +753,7 @@ Sequence< OUString > urihelper_getSupportedServiceNames( )
return serviceNames;
}
-OUString urihelper_getImplementationName( )
+static OUString urihelper_getImplementationName( )
{
return OUString(
"com.sun.star.script.provider.ScriptURIHelper");
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 94c7d0ba85f7..faf2fc3193a4 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -1497,7 +1497,7 @@ void StringResourcePersistenceImpl::importBinary( const Sequence< ::sal_Int8 >&
// Private helper methods
-bool checkNamingSceme( const OUString& aName, const OUString& aNameBase,
+static bool checkNamingSceme( const OUString& aName, const OUString& aNameBase,
Locale& aLocale )
{
bool bSuccess = false;
@@ -1638,7 +1638,7 @@ bool StringResourcePersistenceImpl::implLoadLocale( LocaleItem* )
return false;
}
-OUString implGetNameScemeForLocaleItem( const LocaleItem* pLocaleItem )
+static OUString implGetNameScemeForLocaleItem( const LocaleItem* pLocaleItem )
{
/* FIXME-BCP47: this uses '_' underscore character as separator and
* also appends Variant, which can't be blindly changed as it would
@@ -1697,7 +1697,7 @@ OUString StringResourcePersistenceImpl::implGetPathForLocaleItem
// White space according to Java property files specification in
// http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream)
-inline bool isWhiteSpace( sal_Unicode c )
+static inline bool isWhiteSpace( sal_Unicode c )
{
bool bWhite = ( c == 0x0020 || // space
c == 0x0009 || // tab
@@ -1707,7 +1707,7 @@ inline bool isWhiteSpace( sal_Unicode c )
return bWhite;
}
-inline void skipWhites( const sal_Unicode* pBuf, sal_Int32 nLen, sal_Int32& ri )
+static inline void skipWhites( const sal_Unicode* pBuf, sal_Int32 nLen, sal_Int32& ri )
{
while( ri < nLen )
{
@@ -1717,7 +1717,7 @@ inline void skipWhites( const sal_Unicode* pBuf, sal_Int32 nLen, sal_Int32& ri )
}
}
-inline bool isHexDigit( sal_Unicode c, sal_uInt16& nDigitVal )
+static inline bool isHexDigit( sal_Unicode c, sal_uInt16& nDigitVal )
{
bool bRet = true;
if( c >= '0' && c <= '9' )
@@ -1731,7 +1731,7 @@ inline bool isHexDigit( sal_Unicode c, sal_uInt16& nDigitVal )
return bRet;
}
-sal_Unicode getEscapeChar( const sal_Unicode* pBuf, sal_Int32 nLen, sal_Int32& ri )
+static sal_Unicode getEscapeChar( const sal_Unicode* pBuf, sal_Int32 nLen, sal_Int32& ri )
{
sal_Int32 i = ri;
@@ -1786,7 +1786,7 @@ sal_Unicode getEscapeChar( const sal_Unicode* pBuf, sal_Int32 nLen, sal_Int32& r
return cRet;
}
-void CheckContinueInNextLine( const Reference< io::XTextInputStream2 >& xTextInputStream,
+static void CheckContinueInNextLine( const Reference< io::XTextInputStream2 >& xTextInputStream,
OUString& aLine, bool& bEscapePending, const sal_Unicode*& pBuf,
sal_Int32& nLen, sal_Int32& i )
{
@@ -1928,13 +1928,13 @@ bool StringResourcePersistenceImpl::implReadPropertiesFile
}
-inline sal_Unicode getHexCharForDigit( sal_uInt16 nDigitVal )
+static inline sal_Unicode getHexCharForDigit( sal_uInt16 nDigitVal )
{
sal_Unicode cRet = ( nDigitVal < 10 ) ? ('0' + nDigitVal) : ('a' + (nDigitVal-10));
return cRet;
}
-void implWriteCharToBuffer( OUStringBuffer& aBuf, sal_Unicode cu, bool bKey )
+static void implWriteCharToBuffer( OUStringBuffer& aBuf, sal_Unicode cu, bool bKey )
{
if( cu == '\\' )
{
@@ -1988,7 +1988,7 @@ void implWriteCharToBuffer( OUStringBuffer& aBuf, sal_Unicode cu, bool bKey )
}
}
-void implWriteStringWithEncoding( const OUString& aStr,
+static void implWriteStringWithEncoding( const OUString& aStr,
Reference< io::XTextOutputStream2 > const & xTextOutputStream, bool bKey )
{
static sal_Unicode cLineFeed = 0xa;
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 345c4993b376..3ac632e8c039 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -83,17 +83,17 @@ using namespace ::ooo::vba;
static const char DELIM[] = "::";
static const sal_Int32 DELIMLEN = strlen(DELIM);
-bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
+static bool isKeyEventOk( awt::KeyEvent& evt, const Sequence< Any >& params )
{
return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt );
}
-bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
+static bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
{
return ( params.getLength() > 0 ) && ( params[ 0 ] >>= evt );
}
-Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
+static Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
{
awt::MouseEvent evt;
@@ -104,7 +104,7 @@ Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
return params;
}
-Sequence< Any > ooMouseEvtToVBAMouseEvt( const Sequence< Any >& params )
+static Sequence< Any > ooMouseEvtToVBAMouseEvt( const Sequence< Any >& params )
{
Sequence< Any > translatedParams;
awt::MouseEvent evt;
@@ -125,7 +125,7 @@ Sequence< Any > ooMouseEvtToVBAMouseEvt( const Sequence< Any >& params )
return translatedParams;
}
-Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
+static Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
{
Sequence< Any > translatedParams;
awt::KeyEvent evt;
@@ -140,7 +140,7 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
return translatedParams;
}
-Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
+static Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
{
Sequence< Any > translatedParams;
awt::KeyEvent evt;
@@ -182,10 +182,10 @@ struct TranslatePropMap
TranslateInfo aTransInfo;
};
-bool ApproveAll(const ScriptEvent& evt, void const * pPara); //allow all types of controls to execute the event
-bool ApproveType(const ScriptEvent& evt, void const * pPara); //certain types of controls should execute the event, those types are given by pPara
-bool DenyType(const ScriptEvent& evt, void const * pPara); //certain types of controls should not execute the event, those types are given by pPara
-bool DenyMouseDrag(const ScriptEvent& evt, void const * pPara); //used for VBA MouseMove event when "Shift" key is pressed
+static bool ApproveAll(const ScriptEvent& evt, void const * pPara); //allow all types of controls to execute the event
+static bool ApproveType(const ScriptEvent& evt, void const * pPara); //certain types of controls should execute the event, those types are given by pPara
+static bool DenyType(const ScriptEvent& evt, void const * pPara); //certain types of controls should not execute the event, those types are given by pPara
+static bool DenyMouseDrag(const ScriptEvent& evt, void const * pPara); //used for VBA MouseMove event when "Shift" key is pressed
struct TypeList
{
@@ -254,7 +254,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
{ OUString("keyPressed"), { OUString("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, nullptr } }
};
-EventInfoHash& getEventTransInfo()
+static EventInfoHash& getEventTransInfo()
{
static bool initialised = false;
static EventInfoHash eventTransInfo;
@@ -299,7 +299,7 @@ private:
bool m_bDispose;
};
-bool
+static bool
eventMethodToDescriptor( const OUString& rEventMethod, ScriptEventDescriptor& evtDesc, const OUString& sCodeName )
{
// format of ControlListener is TypeName::methodname e.g.
@@ -742,7 +742,7 @@ bool ApproveAll(SAL_UNUSED_PARAMETER const ScriptEvent&, SAL_UNUSED_PARAMETER vo
}
//for the given control type in evt.Arguments[0], look for if it appears in the type list in pPara
-bool FindControl(const ScriptEvent& evt, void const * pPara)
+static bool FindControl(const ScriptEvent& evt, void const * pPara)
{
lang::EventObject aEvent;
evt.Arguments[ 0 ] >>= aEvent;