summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2013-09-04 14:27:25 +0300
committerTor Lillqvist <tml@collabora.com>2013-09-04 15:00:05 +0300
commit543937297a7e936718a7e37a6ebe30dfc418e567 (patch)
tree31b7bccbf18d9f781f66b3b8ab05c10a2a97228c /scaddins
parent849f7d1484167111f34e2da931fc7b6e57eb1b25 (diff)
WaE: Unreachable code: Use SAL_WNOUNREACHABLE_CODE_PUSH/POP
Cleaner than my first attempt. This reverts commit 853167931600777e7bf44a35e051628a1169bcfc. Change-Id: Ib25b72a1f18d8adef5fa8d2960f233e0a7c29844
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/source/analysis/analysishelper.cxx10
-rw-r--r--scaddins/source/analysis/financial.cxx31
2 files changed, 17 insertions, 24 deletions
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 001223108dee..85eff90ee245 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -1068,8 +1068,9 @@ 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.
+ // If you change this to not unconditionally throw, the
+ // SAL_WNOUNREACHABLE_CODE_PUSH/POP around the caller in
+ // financial.cxx can be removed.
throw uno::RuntimeException(); // #87380#
}
@@ -1153,8 +1154,9 @@ 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.
+ // If you change this to not unconditionally throw, the
+ // SAL_WNOUNREACHABLE_CODE_PUSH/POP around the caller in
+ // financial.cxx can be removed.
throw uno::RuntimeException(); // #87380#
}
diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx
index a34591acf313..bfaec15eb757 100644
--- a/scaddins/source/analysis/financial.cxx
+++ b/scaddins/source/analysis/financial.cxx
@@ -395,6 +395,10 @@ double SAL_CALL AnalysisAddIn::getTbillyield( const css::uno::Reference< css::be
RETURN_FINITE( fRet );
}
+// Encapsulation violation: We *know* that GetOddfprice() always
+// throws.
+
+SAL_WNOUNREACHABLE_CODE_PUSH
double SAL_CALL AnalysisAddIn::getOddfprice( const css::uno::Reference< css::beans::XPropertySet >& xOpt,
sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup,
@@ -403,22 +407,16 @@ 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
}
+SAL_WNOUNREACHABLE_CODE_POP
+
+// Encapsulation violation: We *know* that Getoddfyield() always
+// throws.
+
+SAL_WNOUNREACHABLE_CODE_PUSH
double SAL_CALL AnalysisAddIn::getOddfyield( const css::uno::Reference< css::beans::XPropertySet >& xOpt,
sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup,
@@ -427,19 +425,12 @@ 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
}
+SAL_WNOUNREACHABLE_CODE_POP
double SAL_CALL AnalysisAddIn::getOddlprice( const css::uno::Reference< css::beans::XPropertySet >& xOpt,
sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,