From 7ceee0f1ec0e349d0df4980d7fdedbd13c7917c5 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 9 Oct 2018 10:28:48 +0200 Subject: Extend loplugin:redundantinline to catch inline functions w/o external linkage ...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sal/qa/osl/file/osl_File.cxx | 40 ++++++++++++++++++------------------ sal/qa/osl/module/osl_Module.cxx | 2 +- sal/qa/osl/pipe/osl_Pipe.cxx | 2 +- sal/qa/osl/process/osl_process.cxx | 2 +- sal/qa/osl/security/osl_Security.cxx | 2 +- sal/qa/rtl/process/rtl_Process.cxx | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'sal/qa') diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index bd3729513f7d..fcc8c41cf4ab 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -43,7 +43,7 @@ using namespace osl; /** detailed wrong message. */ -static inline OString errorToString(const osl::FileBase::RC _nError) +static OString errorToString(const osl::FileBase::RC _nError) { OString sResult; switch (_nError) { @@ -103,7 +103,7 @@ static OString errorToStr(osl::FileBase::RC const& nError) # define delta 1800 // time precision, 1.8s #endif -static inline bool t_compareTime(TimeValue *m_aEndTime, TimeValue *m_aStartTime, sal_Int32 nDelta) +static bool t_compareTime(TimeValue *m_aEndTime, TimeValue *m_aStartTime, sal_Int32 nDelta) { sal_Int32 nDeltaSeconds = m_aEndTime->Seconds - m_aStartTime->Seconds; sal_Int32 nDeltaNanoSec = sal_Int32(m_aEndTime->Nanosec) - sal_Int32(m_aStartTime->Nanosec); @@ -119,7 +119,7 @@ static inline bool t_compareTime(TimeValue *m_aEndTime, TimeValue *m_aStartTime /** compare two OUString file name. */ -static inline bool compareFileName(const OUString & ustr1, const OUString & ustr2) +static bool compareFileName(const OUString & ustr1, const OUString & ustr2) { bool bOk; // on Windows, the separator is '\', so here change to '/', then compare @@ -145,14 +145,14 @@ static inline bool compareFileName(const OUString & ustr1, const OUString & ustr /** simple version to judge if a file name or directory name is a URL or a system path, just to see if it is start with "file:///";. */ -static inline bool isURL(const OUString& pathname) +static bool isURL(const OUString& pathname) { return pathname.startsWith(aPreURL); } /** concat two part to form a URL or system path, add PATH_SEPARATOR between them if necessary, add "file:///" to beginning if necessary. */ -static inline void concatURL(OUString & pathname1, const OUString & pathname2) +static void concatURL(OUString & pathname1, const OUString & pathname2) { // check if pathname1 is full qualified URL; if (!isURL(pathname1)) @@ -170,7 +170,7 @@ static inline void concatURL(OUString & pathname1, const OUString & pathname2) /** create a temp test file using OUString name of full qualified URL or system path. */ -static inline void createTestFile(const OUString& filename) +static void createTestFile(const OUString& filename) { OUString aPathURL = filename.copy(0); osl::FileBase::RC nError; @@ -189,7 +189,7 @@ static inline void createTestFile(const OUString& filename) /** create a temp test file using OUString name of full qualified URL or system path in a base directory. */ -static inline void createTestFile(const OUString& basename, const OUString& filename) +static void createTestFile(const OUString& basename, const OUString& filename) { OUString aBaseURL = basename.copy(0); @@ -199,7 +199,7 @@ static inline void createTestFile(const OUString& basename, const OUString& file /** delete a temp test file using OUString name. */ -static inline void deleteTestFile(const OUString& filename) +static void deleteTestFile(const OUString& filename) { OUString aPathURL = filename.copy(0); osl::FileBase::RC nError; @@ -216,7 +216,7 @@ static inline void deleteTestFile(const OUString& filename) /** delete a temp test file using OUString name of full qualified URL or system path in a base directory. */ -static inline void deleteTestFile(const OUString& basename, const OUString& filename) +static void deleteTestFile(const OUString& basename, const OUString& filename) { OUString aBaseURL = basename.copy(0); @@ -226,7 +226,7 @@ static inline void deleteTestFile(const OUString& basename, const OUString& file /** create a temp test directory using OUString name of full qualified URL or system path. */ -static inline void createTestDirectory(const OUString& dirname) +static void createTestDirectory(const OUString& dirname) { OUString aPathURL = dirname.copy(0); osl::FileBase::RC nError; @@ -240,7 +240,7 @@ static inline void createTestDirectory(const OUString& dirname) /** create a temp test directory using OUString name of full qualified URL or system path in a base directory. */ -static inline void createTestDirectory(const OUString& basename, const OUString& dirname) +static void createTestDirectory(const OUString& basename, const OUString& dirname) { OUString aBaseURL = basename.copy(0); @@ -250,7 +250,7 @@ static inline void createTestDirectory(const OUString& basename, const OUString& /** delete a temp test directory using OUString name of full qualified URL or system path. */ -static inline void deleteTestDirectory(const OUString& dirname) +static void deleteTestDirectory(const OUString& dirname) { OUString aPathURL = dirname.copy(0); osl::FileBase::RC nError; @@ -270,7 +270,7 @@ static inline void deleteTestDirectory(const OUString& dirname) /** delete a temp test directory using OUString name of full qualified URL or system path in a base directory. */ -static inline void deleteTestDirectory(const OUString& basename, const OUString& dirname) +static void deleteTestDirectory(const OUString& basename, const OUString& dirname) { OUString aBaseURL = basename.copy(0); @@ -288,7 +288,7 @@ enum class oslCheckMode { /** check if the file exist */ -static inline bool ifFileExist(const OUString & str) +static bool ifFileExist(const OUString & str) { File testFile(str); return (testFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None); @@ -296,7 +296,7 @@ static inline bool ifFileExist(const OUString & str) /** check if the file can be written */ -static inline bool ifFileCanWrite(const OUString & str) +static bool ifFileCanWrite(const OUString & str) { // on Windows, the file has no write right, but can be written #ifdef _WIN32 @@ -317,7 +317,7 @@ static inline bool ifFileCanWrite(const OUString & str) return bCheckResult; } -static inline bool checkDirectory(const OUString& str, oslCheckMode nCheckMode) +static bool checkDirectory(const OUString& str, oslCheckMode nCheckMode) { OUString aUString; DirectoryItem rItem; @@ -366,7 +366,7 @@ static inline bool checkDirectory(const OUString& str, oslCheckMode nCheckMode) /** construct error message */ -static inline OString outputError(const OString & returnVal, const OString & rightVal, const sal_Char * msg = "") +static OString outputError(const OString & returnVal, const OString & rightVal, const sal_Char * msg = "") { OString aString; if (returnVal == rightVal) @@ -384,7 +384,7 @@ static inline OString outputError(const OString & returnVal, const OString & rig /** Change file mode, two version in UNIX and Windows;. */ #if (defined UNX) /* chmod() method is different in Windows */ -static inline void changeFileMode(OUString & filepath, sal_Int32 mode) +static void changeFileMode(OUString & filepath, sal_Int32 mode) { OString aString; OUString aUStr = filepath.copy(0); @@ -405,7 +405,7 @@ inline void changeFileMode(OUString & filepath, sal_Int32 mode) } #endif -static inline OUString getCurrentPID(); +static OUString getCurrentPID(); // Beginning of the test cases for osl::FileBase class @@ -5133,7 +5133,7 @@ namespace osl_Directory /** get Current PID. */ -inline OUString getCurrentPID() +OUString getCurrentPID() { //~ Get current PID and turn it into OUString; int nPID = 0; diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index 04af99487f85..9910925e3c5a 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -27,7 +27,7 @@ using ::rtl::OUString; /** get dll file URL. */ -static inline ::rtl::OUString getDllURL() +static ::rtl::OUString getDllURL() { #if defined(_WIN32) // lib in Unix and lib in Windows are not same in file name. ::rtl::OUString libPath( "test_Module_DLL.dll" ); diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 74f45b2faa21..683cbf83f2ce 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -44,7 +44,7 @@ using ::rtl::OString; /** print last error of pipe system. */ -static inline void printPipeError( ::osl::Pipe const & aPipe ) +static void printPipeError( ::osl::Pipe const & aPipe ) { oslPipeError nError = aPipe.getError( ); printf("#printPipeError# " ); diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index 8b99d7089b99..47d0eeba4d0c 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -71,7 +71,7 @@ using ::rtl::OString; /** get binary Path. */ -static inline ::rtl::OUString getExecutablePath() +static ::rtl::OUString getExecutablePath() { ::rtl::OUString dirPath; osl::Module::getUrlFromAddress( diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index cba8b125bb17..85b0e8f0fb0b 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -38,7 +38,7 @@ using namespace rtl; /** print a UNI_CODE String. */ -static inline void printUString( const ::rtl::OUString & str ) +static void printUString( const ::rtl::OUString & str ) { rtl::OString aString; diff --git a/sal/qa/rtl/process/rtl_Process.cxx b/sal/qa/rtl/process/rtl_Process.cxx index 07c7059bbc56..ab3b8433d4c3 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. */ -static inline void printUString( const ::rtl::OUString & str, const sal_Char * msg ) +static void printUString( const ::rtl::OUString & str, const sal_Char * msg ) { if ( msg != nullptr ) { @@ -54,7 +54,7 @@ static inline void printUString( const ::rtl::OUString & str, const sal_Char * m printf("%s\n", aString.getStr( ) ); } -static inline ::rtl::OUString getModulePath() +static ::rtl::OUString getModulePath() { ::rtl::OUString suDirPath; ::osl::Module::getUrlFromAddress( -- cgit