summaryrefslogtreecommitdiff
path: root/sal/qa/rtl
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 /sal/qa/rtl
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 'sal/qa/rtl')
-rw-r--r--sal/qa/rtl/alloc/rtl_alloc.cxx2
-rw-r--r--sal/qa/rtl/doublelock/rtl_doublelocking.cxx2
-rw-r--r--sal/qa/rtl/locale/rtl_locale.cxx2
-rw-r--r--sal/qa/rtl/process/rtl_Process.cxx8
-rw-r--r--sal/qa/rtl/ref/rtl_ref.cxx2
-rw-r--r--sal/qa/rtl/strings/test_ostring_concat.cxx2
-rw-r--r--sal/qa/rtl/strings/test_oustring_concat.cxx2
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx4
-rw-r--r--sal/qa/rtl/strings/test_strings_valuex.cxx4
9 files changed, 14 insertions, 14 deletions
diff --git a/sal/qa/rtl/alloc/rtl_alloc.cxx b/sal/qa/rtl/alloc/rtl_alloc.cxx
index f59d78f9fa6c..419a3f3b03ca 100644
--- a/sal/qa/rtl/alloc/rtl_alloc.cxx
+++ b/sal/qa/rtl/alloc/rtl_alloc.cxx
@@ -33,7 +33,7 @@ namespace rtl_alloc
// small memory check routine, which return false, if there is a problem
- bool checkMemory(const char* _pMemory, sal_uInt32 _nSize, char _n)
+ static bool checkMemory(const char* _pMemory, sal_uInt32 _nSize, char _n)
{
bool bOk = true;
diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
index e37400ba7f8f..befc16f36e92 100644
--- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
+++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx
@@ -60,7 +60,7 @@ namespace ThreadHelper
// VERBOSE
// } eSleepVerboseMode;
- void thread_sleep_tenth_sec(sal_Int32 _nTenthSec/*, eSleepVerboseMode nVerbose = VERBOSE*/)
+ static void thread_sleep_tenth_sec(sal_Int32 _nTenthSec/*, eSleepVerboseMode nVerbose = VERBOSE*/)
{
// if (nVerbose == VERBOSE)
// {
diff --git a/sal/qa/rtl/locale/rtl_locale.cxx b/sal/qa/rtl/locale/rtl_locale.cxx
index b08011609fb9..80807d9ecffd 100644
--- a/sal/qa/rtl/locale/rtl_locale.cxx
+++ b/sal/qa/rtl/locale/rtl_locale.cxx
@@ -28,7 +28,7 @@
namespace rtl_locale
{
// default locale for test purpose
- void setDefaultLocale()
+ static void setDefaultLocale()
{
rtl_locale_setDefault(rtl::OUString("de").getStr(), rtl::OUString("DE").getStr(), /* rtl::OUString() */ rtl::OUString("hochdeutsch").getStr() );
}
diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx
index 4f37f203781d..07c7059bbc56 100644
--- a/sal/qa/rtl/process/rtl_Process.cxx
+++ b/sal/qa/rtl/process/rtl_Process.cxx
@@ -43,7 +43,7 @@ using ::rtl::OUStringToOString;
/** print a UNI_CODE String. And also print some comments of the string.
*/
-inline void printUString( const ::rtl::OUString & str, const sal_Char * msg )
+static inline void printUString( const ::rtl::OUString & str, const sal_Char * msg )
{
if ( msg != nullptr )
{
@@ -54,7 +54,7 @@ inline void printUString( const ::rtl::OUString & str, const sal_Char * msg )
printf("%s\n", aString.getStr( ) );
}
-inline ::rtl::OUString getModulePath()
+static inline ::rtl::OUString getModulePath()
{
::rtl::OUString suDirPath;
::osl::Module::getUrlFromAddress(
@@ -144,7 +144,7 @@ public:
/************************************************************************
* For diagnostics( from sal/test/testuuid.cxx )
************************************************************************/
-void printUuid( const sal_uInt8 *pNode )
+static void printUuid( const sal_uInt8 *pNode )
{
printf("# UUID is: ");
for( sal_Int32 i1 = 0 ; i1 < 4 ; i1++ )
@@ -168,7 +168,7 @@ void printUuid( const sal_uInt8 *pNode )
/**************************************************************************
* output UUID to a string
**************************************************************************/
-void printUuidtoBuffer( const sal_uInt8 *pNode, sal_Char * pBuffer )
+static void printUuidtoBuffer( const sal_uInt8 *pNode, sal_Char * pBuffer )
{
sal_Int8 nPtr = 0;
for( sal_Int32 i1 = 0 ; i1 < 16 ; i1++ )
diff --git a/sal/qa/rtl/ref/rtl_ref.cxx b/sal/qa/rtl/ref/rtl_ref.cxx
index a2c22d2e8da5..2c7d3aae5276 100644
--- a/sal/qa/rtl/ref/rtl_ref.cxx
+++ b/sal/qa/rtl/ref/rtl_ref.cxx
@@ -45,7 +45,7 @@ public:
void set_inc_flag() { m_bIncFlag = true; }
};
-rtl::Reference< MoveTestClass > get_reference( MoveTestClass* pcTestClass )
+static rtl::Reference< MoveTestClass > get_reference( MoveTestClass* pcTestClass )
{
// constructor will increment the reference count
pcTestClass->set_inc_flag();
diff --git a/sal/qa/rtl/strings/test_ostring_concat.cxx b/sal/qa/rtl/strings/test_ostring_concat.cxx
index 80fa62df6be5..4f4f2e3f799b 100644
--- a/sal/qa/rtl/strings/test_ostring_concat.cxx
+++ b/sal/qa/rtl/strings/test_ostring_concat.cxx
@@ -27,7 +27,7 @@ using namespace rtl;
namespace std
{
-template< typename charT, typename traits > std::basic_ostream<charT, traits> &
+template< typename charT, typename traits > static std::basic_ostream<charT, traits> &
operator <<(
std::basic_ostream<charT, traits> & stream, const std::type_info& info )
{
diff --git a/sal/qa/rtl/strings/test_oustring_concat.cxx b/sal/qa/rtl/strings/test_oustring_concat.cxx
index 1af3f60dd3aa..874666869554 100644
--- a/sal/qa/rtl/strings/test_oustring_concat.cxx
+++ b/sal/qa/rtl/strings/test_oustring_concat.cxx
@@ -26,7 +26,7 @@ using namespace rtl;
namespace std
{
-template< typename charT, typename traits > std::basic_ostream<charT, traits> &
+template< typename charT, typename traits > static std::basic_ostream<charT, traits> &
operator <<(
std::basic_ostream<charT, traits> & stream, const std::type_info& info )
{
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 687f6b3e5146..a98401351a7f 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -58,7 +58,7 @@ CPPUNIT_TEST_SUITE_END();
// reset the flag, evaluate the expression and return
// whether the string literal ctor was used (i.e. whether the conversion was valid)
-template<typename T> bool VALID_CONVERSION( T && expression )
+template<typename T> static bool VALID_CONVERSION( T && expression )
{
rtl_string_unittest_invalid_conversion = false;
// OK to std::forward expression twice; what is relevant in both ctor calls
@@ -68,7 +68,7 @@ template<typename T> bool VALID_CONVERSION( T && expression )
( void ) rtl::OUStringBuffer( std::forward<T>(expression) );
return !rtl_string_unittest_invalid_conversion;
}
-template<typename T> bool VALID_CONVERSION_CALL( T f )
+template<typename T> static bool VALID_CONVERSION_CALL( T f )
{
rtl_string_unittest_invalid_conversion = false;
( void ) rtl::OUString( f() );
diff --git a/sal/qa/rtl/strings/test_strings_valuex.cxx b/sal/qa/rtl/strings/test_strings_valuex.cxx
index 7b879e7c31bf..5253a4b99ddb 100644
--- a/sal/qa/rtl/strings/test_strings_valuex.cxx
+++ b/sal/qa/rtl/strings/test_strings_valuex.cxx
@@ -57,7 +57,7 @@ void test::strings::valueX::testOUBoolean() {
}
template< typename T >
-void testInt() {
+static void testInt() {
CPPUNIT_ASSERT_EQUAL( T( "30039062" ), T::number( 30039062 ));
// test the overloading resolution
@@ -99,7 +99,7 @@ void test::strings::valueX::testOInt() {
}
template< typename T >
-void testFloat() {
+static void testFloat() {
CPPUNIT_ASSERT_EQUAL( T( "39062.2" ), T::number( 39062.2f ));
CPPUNIT_ASSERT_EQUAL( T( "30039062.2" ), T::number( 30039062.2 ));
// long double not supported