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 /scripting/source/stringresource | |
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 'scripting/source/stringresource')
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
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; |