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 /basic/source/runtime/methods1.cxx | |
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 'basic/source/runtime/methods1.cxx')
-rw-r--r-- | basic/source/runtime/methods1.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index 7f5ab0233096..514c8e1e85b0 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1127,7 +1127,7 @@ static bool lcl_WriteReadSbxArray( SbxDimArray& rArr, SvStream* pStrm, return true; } -void PutGet( SbxArray& rPar, bool bPut ) +static void PutGet( SbxArray& rPar, bool bPut ) { if ( rPar.Count() != 4 ) { @@ -1802,7 +1802,7 @@ struct IntervalInfo bool mbSimple; }; -IntervalInfo const * getIntervalInfo( const OUString& rStringCode ) +static IntervalInfo const * getIntervalInfo( const OUString& rStringCode ) { static IntervalInfo const aIntervalTable[] = { @@ -1828,7 +1828,7 @@ IntervalInfo const * getIntervalInfo( const OUString& rStringCode ) return nullptr; } -inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int16& rnDay, double dDate ) +static inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int16& rnDay, double dDate ) { rnDay = implGetDateDay( dDate ); rnMonth = implGetDateMonth( dDate ); @@ -1840,7 +1840,7 @@ inline void implGetDayMonthYear( sal_Int16& rnYear, sal_Int16& rnMonth, sal_Int1 @return the year number, truncated if necessary and in that case also rMonth and rDay adjusted. */ -inline sal_Int16 limitDate( sal_Int32 n32Year, sal_Int16& rMonth, sal_Int16& rDay ) +static inline sal_Int16 limitDate( sal_Int32 n32Year, sal_Int16& rMonth, sal_Int16& rDay ) { if( n32Year > SAL_MAX_INT16 ) { @@ -1957,7 +1957,7 @@ void SbRtl_DateAdd(StarBASIC *, SbxArray & rPar, bool) rPar.Get(0)->PutDate( dNewDate ); } -inline double RoundImpl( double d ) +static inline double RoundImpl( double d ) { return ( d >= 0 ) ? floor( d + 0.5 ) : -floor( -d + 0.5 ); } @@ -2087,7 +2087,7 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool) rPar.Get(0)->PutDouble( dRet ); } -double implGetDateOfFirstDayInFirstWeek +static double implGetDateOfFirstDayInFirstWeek ( sal_Int16 nYear, sal_Int16& nFirstDay, sal_Int16& nFirstWeek, bool* pbError = nullptr ) { ErrCode nError = ERRCODE_NONE; @@ -2438,7 +2438,7 @@ void SbRtl_Round(StarBASIC *, SbxArray & rPar, bool) rPar.Get(0)->PutDouble( dRes ); } -void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const OUString& sFuncName, SbxVariable* pRet ) +static void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const OUString& sFuncName, SbxVariable* pRet ) { static Reference< XFunctionAccess > xFunc; try |