diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-09-15 19:13:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-09-17 09:05:38 +0200 |
commit | 206b5b2661be37efdff3c6aedb6f248c4636be79 (patch) | |
tree | af385e5b4725dcfea23988d9113cced8e9ccaf3c /sal/osl | |
parent | a85d3ba1c0de313b60324b9ecfa488bb99d69d06 (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/osl')
-rw-r--r-- | sal/osl/unx/file_path_helper.cxx | 6 | ||||
-rw-r--r-- | sal/osl/unx/pipe.cxx | 4 | ||||
-rw-r--r-- | sal/osl/unx/process.cxx | 6 | ||||
-rw-r--r-- | sal/osl/unx/socket.cxx | 20 | ||||
-rw-r--r-- | sal/osl/unx/uunxapi.cxx | 2 |
5 files changed, 19 insertions, 19 deletions
diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index a5b5dd985511..cff84e395561 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -28,13 +28,13 @@ const sal_Unicode FPH_CHAR_PATH_SEPARATOR = '/'; const sal_Unicode FPH_CHAR_DOT = '.'; const sal_Unicode FPH_CHAR_COLON = ':'; -inline const rtl::OUString FPH_PATH_SEPARATOR() +static inline const rtl::OUString FPH_PATH_SEPARATOR() { return rtl::OUString(FPH_CHAR_PATH_SEPARATOR); } -inline const rtl::OUString FPH_LOCAL_DIR_ENTRY() +static inline const rtl::OUString FPH_LOCAL_DIR_ENTRY() { return rtl::OUString(FPH_CHAR_DOT); } -inline const rtl::OUString FPH_PARENT_DIR_ENTRY() +static inline const rtl::OUString FPH_PARENT_DIR_ENTRY() { return rtl::OUString(".."); } void osl_systemPathRemoveSeparator(rtl_uString* pustrPath) diff --git a/sal/osl/unx/pipe.cxx b/sal/osl/unx/pipe.cxx index eb03ff2280c5..1c470b7fe3cd 100644 --- a/sal/osl/unx/pipe.cxx +++ b/sal/osl/unx/pipe.cxx @@ -39,7 +39,7 @@ #define PIPENAMEMASK "OSL_PIPE_%s" #define SECPIPENAMEMASK "OSL_PIPE_%s_%s" -oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Options, oslSecurity Security); +static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Options, oslSecurity Security); static struct { @@ -158,7 +158,7 @@ cpyBootstrapSocketPath(sal_Char *name, size_t len) return bRet; } -oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Options, +static oslPipe osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions Options, oslSecurity Security) { int Flags; diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index d52452cd5e38..b88e5246d1a7 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -96,7 +96,7 @@ static oslMutex ChildListMutex; } //Anonymous namespace -oslProcessError osl_psz_executeProcess(sal_Char *pszImageName, +static oslProcessError osl_psz_executeProcess(sal_Char *pszImageName, sal_Char *pszArguments[], oslProcessOption Options, oslSecurity Security, @@ -848,7 +848,7 @@ struct osl_procStat unsigned long vm_lib; /* library size */ }; -bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) +static bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) { int fd = 0; bool bRet = false; @@ -904,7 +904,7 @@ bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) return bRet; } -bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) +static bool osl_getProcStatus(pid_t pid, struct osl_procStat* procstat) { int fd = 0; char name[PATH_MAX + 1]; diff --git a/sal/osl/unx/socket.cxx b/sal/osl/unx/socket.cxx index edacf5f5e565..b73ce1966847 100644 --- a/sal/osl/unx/socket.cxx +++ b/sal/osl/unx/socket.cxx @@ -252,34 +252,34 @@ static oslSocketError osl_SocketErrorFromNative(int nativeType) #define ERROR_FROM_NATIVE(y) osl_SocketErrorFromNative(y) -oslSocketAddr osl_psz_createInetSocketAddr ( +static oslSocketAddr osl_psz_createInetSocketAddr ( const sal_Char* pszDottedAddr, sal_Int32 Port); -oslHostAddr osl_psz_createHostAddr ( +static oslHostAddr osl_psz_createHostAddr ( const sal_Char *pszHostname, const oslSocketAddr Addr); -oslHostAddr osl_psz_createHostAddrByName ( +static oslHostAddr osl_psz_createHostAddrByName ( const sal_Char *pszHostname); -const sal_Char* osl_psz_getHostnameOfHostAddr ( +static const sal_Char* osl_psz_getHostnameOfHostAddr ( const oslHostAddr Addr); -oslSocketResult osl_psz_getLocalHostname ( +static oslSocketResult osl_psz_getLocalHostname ( sal_Char *pBuffer, sal_uInt32 nBufLen); -oslSocketAddr osl_psz_resolveHostname ( +static oslSocketAddr osl_psz_resolveHostname ( const sal_Char* pszHostname); -sal_Int32 osl_psz_getServicePort ( +static sal_Int32 osl_psz_getServicePort ( const sal_Char* pszServicename, const sal_Char* pszProtocol); -oslSocketResult osl_psz_getHostnameOfSocketAddr ( +static oslSocketResult osl_psz_getHostnameOfSocketAddr ( oslSocketAddr Addr, sal_Char *pBuffer, sal_uInt32 BufferSize); -oslSocketResult osl_psz_getDottedInetAddrOfSocketAddr ( +static oslSocketResult osl_psz_getDottedInetAddrOfSocketAddr ( oslSocketAddr Addr, sal_Char *pBuffer, sal_uInt32 BufferSize); -void osl_psz_getLastSocketErrorDescription ( +static void osl_psz_getLastSocketErrorDescription ( oslSocket Socket, sal_Char* pBuffer, sal_uInt32 BufferSize); static oslSocket createSocketImpl(int Socket) diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 3c50a10ac550..a6b80daa9e2a 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -29,7 +29,7 @@ #include <osl/detail/android-bootstrap.h> #endif -inline rtl::OString OUStringToOString(const rtl_uString* s) +static inline rtl::OString OUStringToOString(const rtl_uString* s) { return rtl::OUStringToOString(rtl::OUString(const_cast<rtl_uString*>(s)), osl_getThreadTextEncoding()); |