summaryrefslogtreecommitdiff
path: root/scaddins/source
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 /scaddins/source
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 'scaddins/source')
-rw-r--r--scaddins/source/analysis/analysishelper.cxx10
-rw-r--r--scaddins/source/analysis/bessel.cxx8
-rw-r--r--scaddins/source/datefunc/datefunc.cxx4
-rw-r--r--scaddins/source/pricing/black_scholes.cxx24
-rw-r--r--scaddins/source/pricing/pricing.cxx2
5 files changed, 24 insertions, 24 deletions
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 50e1c84720eb..20bd97273fc3 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -769,31 +769,31 @@ double Erfc( double x )
return ::rtl::math::erfc(x);
}
-inline bool IsNum( sal_Unicode c )
+static inline bool IsNum( sal_Unicode c )
{
return c >= '0' && c <= '9';
}
-inline bool IsComma( sal_Unicode c )
+static inline bool IsComma( sal_Unicode c )
{
return c == '.' || c == ',';
}
-inline bool IsExpStart( sal_Unicode c )
+static inline bool IsExpStart( sal_Unicode c )
{
return c == 'e' || c == 'E';
}
-inline bool IsImagUnit( sal_Unicode c )
+static inline bool IsImagUnit( sal_Unicode c )
{
return c == 'i' || c == 'j';
}
-inline sal_uInt16 GetVal( sal_Unicode c )
+static inline sal_uInt16 GetVal( sal_Unicode c )
{
return sal_uInt16( c - '0' );
}
diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx
index 31c092e20c99..ef8cffacbd44 100644
--- a/scaddins/source/analysis/bessel.cxx
+++ b/scaddins/source/analysis/bessel.cxx
@@ -223,7 +223,7 @@ double BesselI( double x, sal_Int32 n )
/// @throws IllegalArgumentException
/// @throws NoConvergenceException
-double Besselk0( double fNum )
+static double Besselk0( double fNum )
{
double fRet;
@@ -250,7 +250,7 @@ double Besselk0( double fNum )
/// @throws IllegalArgumentException
/// @throws NoConvergenceException
-double Besselk1( double fNum )
+static double Besselk1( double fNum )
{
double fRet;
@@ -322,7 +322,7 @@ double BesselK( double fNum, sal_Int32 nOrder )
/// @throws IllegalArgumentException
/// @throws NoConvergenceException
-double Bessely0( double fX )
+static double Bessely0( double fX )
{
if (fX <= 0)
throw IllegalArgumentException();
@@ -375,7 +375,7 @@ double Bessely0( double fX )
// https://bz.apache.org/ooo/attachment.cgi?id=63609
/// @throws IllegalArgumentException
/// @throws NoConvergenceException
-double Bessely1( double fX )
+static double Bessely1( double fX )
{
if (fX <= 0)
throw IllegalArgumentException();
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index 407b8425fe10..ae626c9fcaf5 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -81,14 +81,14 @@ sal_uInt16 ScaFuncData::GetStrIndex( sal_uInt16 nParam ) const
return (nParam > nParamCount) ? (nParamCount * 2) : (nParam * 2);
}
-void InitScaFuncDataList(ScaFuncDataList& rList)
+static void InitScaFuncDataList(ScaFuncDataList& rList)
{
for (const auto & nIndex : pFuncDataArr)
rList.push_back(ScaFuncData(nIndex));
}
// entry points for service registration / instantiation
-uno::Reference< uno::XInterface > ScaDateAddIn_CreateInstance(
+static uno::Reference< uno::XInterface > ScaDateAddIn_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory >& )
{
return static_cast<cppu::OWeakObject*>(new ScaDateAddIn());
diff --git a/scaddins/source/pricing/black_scholes.cxx b/scaddins/source/pricing/black_scholes.cxx
index fe111f03858a..ff5c5f71cda6 100644
--- a/scaddins/source/pricing/black_scholes.cxx
+++ b/scaddins/source/pricing/black_scholes.cxx
@@ -86,16 +86,16 @@ namespace bs {
// helper functions
-inline double sqr(double x) {
+static inline double sqr(double x) {
return x*x;
}
// normal density (see also ScInterpreter::phi)
-inline double dnorm(double x) {
+static inline double dnorm(double x) {
//return (1.0/sqrt(2.0*M_PI))*exp(-0.5*x*x); // windows may not have M_PI
return 0.39894228040143268*exp(-0.5*x*x);
}
// cumulative normal distribution (see also ScInterpreter::integralPhi)
-inline double pnorm(double x) {
+static inline double pnorm(double x) {
//return 0.5*(erf(sqrt(0.5)*x)+1.0); // windows may not have erf
return 0.5 * ::rtl::math::erfc(-x * 0.7071067811865475);
}
@@ -293,7 +293,7 @@ double binasset(double S, double vol, double rd, double rf,
// one function binary
// using bincash() if fd==types::Domestic
// using binasset() if fd==types::Foreign
-double binary(double S, double vol, double rd, double rf,
+static double binary(double S, double vol, double rd, double rf,
double tau, double K,
types::PutCall pc, types::ForDom fd,
types::Greeks greek) {
@@ -316,7 +316,7 @@ double binary(double S, double vol, double rd, double rf,
// into one function
// B1<=0 - it is assumed lower barrier not set
// B2<=0 - it is assumed upper barrier not set
-double binary(double S, double vol, double rd, double rf,
+static double binary(double S, double vol, double rd, double rf,
double tau, double B1, double B2,
types::ForDom fd, types::Greeks greek) {
assert(tau>=0.0);
@@ -503,7 +503,7 @@ namespace internal {
// going to path-dependent barrier options,
// K<0 - assume binary option
// K>=0 - assume put/call option
-double vanilla(double S, double vol, double rd, double rf,
+static double vanilla(double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2,
types::PutCall pc, types::ForDom fd,
types::Greeks greek) {
@@ -516,7 +516,7 @@ double vanilla(double S, double vol, double rd, double rf,
}
return val;
}
-double vanilla_trunc(double S, double vol, double rd, double rf,
+static double vanilla_trunc(double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2,
types::PutCall pc, types::ForDom fd,
types::Greeks greek) {
@@ -546,7 +546,7 @@ namespace internal {
// with sc=1 and V1() being the price of the respective truncated
// vanilla option, V() would be the price of the respective barrier
// option if only one barrier is present
-double barrier_term(double S, double vol, double rd, double rf,
+static double barrier_term(double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2, double sc,
types::PutCall pc, types::ForDom fd,
types::Greeks greek) {
@@ -651,7 +651,7 @@ double barrier_term(double S, double vol, double rd, double rf,
}
// one term of the infinite sum for the valuation of double barriers
-double barrier_double_term( double S, double vol, double rd, double rf,
+static double barrier_double_term( double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2,
double fac, double sc, int i,
types::PutCall pc, types::ForDom fd, types::Greeks greek) {
@@ -709,7 +709,7 @@ double barrier_double_term( double S, double vol, double rd, double rf,
// general pricer for any type of options with continuously monitored barriers
// allows two, one or zero barriers, only knock-out style
// payoff profiles allowed based on vanilla_trunc()
-double barrier_ko(double S, double vol, double rd, double rf,
+static double barrier_ko(double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2,
types::PutCall pc, types::ForDom fd,
types::Greeks greek) {
@@ -784,7 +784,7 @@ double barrier_ko(double S, double vol, double rd, double rf,
}
// knock-in style barrier
-double barrier_ki(double S, double vol, double rd, double rf,
+static double barrier_ki(double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2,
types::PutCall pc, types::ForDom fd,
types::Greeks greek) {
@@ -793,7 +793,7 @@ double barrier_ki(double S, double vol, double rd, double rf,
}
// general barrier
-double barrier(double S, double vol, double rd, double rf,
+static double barrier(double S, double vol, double rd, double rf,
double tau, double K, double B1, double B2,
types::PutCall pc, types::ForDom fd,
types::BarrierKIO kio, types::BarrierActive bcont,
diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx
index eaf76ff60418..51a76f216663 100644
--- a/scaddins/source/pricing/pricing.cxx
+++ b/scaddins/source/pricing/pricing.cxx
@@ -91,7 +91,7 @@ void sca::pricing::InitScaFuncDataList(ScaFuncDataList& rList)
}
// entry points for service registration / instantiation
-uno::Reference< uno::XInterface > ScaPricingAddIn_CreateInstance(
+static uno::Reference< uno::XInterface > ScaPricingAddIn_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory >& )
{
return static_cast<cppu::OWeakObject*>(new ScaPricingAddIn());