summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-09-04 08:54:21 +0300
committerTor Lillqvist <tml@collabora.com>2013-09-04 08:55:20 +0300
commit853167931600777e7bf44a35e051628a1169bcfc (patch)
tree1f8cdada8458a798ba5af83dd875bcad2a6fc29d /scaddins
parent37f1a6d35acd13ab356323637ecb2c8de076bf1c (diff)
WaE: unreachable code
Noticed during inlining at link-time code generation phase: The called function always throws. So let's hardcode the throw for now then at the callsite instead. Not ideal, I know. Add comments describing what is going on. Change-Id: I60d14b25aa62846fc0314aad7e00b2990f4cff26
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/source/analysis/analysishelper.cxx4
-rw-r--r--scaddins/source/analysis/financial.cxx20
2 files changed, 24 insertions, 0 deletions
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 05b6bbfbd237..001223108dee 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -1068,6 +1068,8 @@ double GetOddfprice( sal_Int32 /*nNullDate*/, sal_Int32 /*nSettle*/, sal_Int32 /
sal_Int32 /*nFirstCoup*/, double /*fRate*/, double /*fYield*/, double /*fRedemp*/, sal_Int32 /*nFreq*/,
sal_Int32 /*nBase*/ ) throw( uno::RuntimeException, lang::IllegalArgumentException )
{
+ // If you ever change this to not unconditionally throw, adapt
+ // getOddfprice() (note lower-case 'g') in financial.cxx.
throw uno::RuntimeException(); // #87380#
}
@@ -1151,6 +1153,8 @@ double GetOddfyield( sal_Int32 /*nNullDate*/, sal_Int32 /*nSettle*/, sal_Int32 /
sal_Int32 /*nFirstCoup*/, double /*fRate*/, double /*fPrice*/, double /*fRedemp*/, sal_Int32 /*nFreq*/,
sal_Int32 /*nBase*/ ) throw( uno::RuntimeException, lang::IllegalArgumentException )
{
+ // Ditto here, if you change this to not throw unconditionally,
+ // adapt getOddfyield() in financial.cxx.
throw uno::RuntimeException(); // #87380#
}
diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx
index dd637c69f15f..a34591acf313 100644
--- a/scaddins/source/analysis/financial.cxx
+++ b/scaddins/source/analysis/financial.cxx
@@ -403,8 +403,20 @@ double SAL_CALL AnalysisAddIn::getOddfprice( const css::uno::Reference< css::bea
if( fRate < 0.0 || fYield < 0.0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
throw css::lang::IllegalArgumentException();
+#if !(defined(_MSC_VER) && defined(ENABLE_LTO))
double fRet = GetOddfprice( GetNullDate( xOpt ), nSettle, nMat, nIssue, nFirstCoup, fRate, fYield, fRedemp, nFreq, getDateMode( xOpt, rOB ) );
RETURN_FINITE( fRet );
+#else
+ // During link-time optimization the compiler inlines the above
+ // call to GetOddfprice() (note upper-case 'G') (from
+ // analysishelper.cxx), and notices that GetOddfprice() always
+ // throws, so the assignment and return are unreachable. Avoid
+ // that warning by throwing directly here.
+ (void) rOB;
+ (void) fRedemp;
+ (void) xOpt;
+ throw css::uno::RuntimeException();
+#endif
}
@@ -415,9 +427,17 @@ double SAL_CALL AnalysisAddIn::getOddfyield( const css::uno::Reference< css::bea
if( fRate < 0.0 || fPrice <= 0.0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
throw css::lang::IllegalArgumentException();
+#if !(defined(_MSC_VER) && defined(ENABLE_LTO))
double fRet = GetOddfyield( GetNullDate( xOpt ), nSettle, nMat, nIssue, nFirstCoup, fRate, fPrice, fRedemp, nFreq,
getDateMode( xOpt, rOB ) );
RETURN_FINITE( fRet );
+#else
+ // Same story here, see comment in getOddfprice()
+ (void) rOB;
+ (void) fRedemp;
+ (void) xOpt;
+ throw css::uno::RuntimeException();
+#endif
}