Kaydet (Commit) 54393729 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

WaE: Unreachable code: Use SAL_WNOUNREACHABLE_CODE_PUSH/POP

Cleaner than my first attempt.

This reverts commit 85316793.

Change-Id: Ib25b72a1f18d8adef5fa8d2960f233e0a7c29844
üst 849f7d14
......@@ -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#
}
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment