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

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
üst 37f1a6d3
......@@ -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#
}
......
......@@ -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
}
......
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