[Libreoffice-commits] core.git: 2 commits - basic/source scaddins/source

Tor Lillqvist tml at collabora.com
Tue Sep 3 22:55:47 PDT 2013


 basic/source/runtime/dllmgr-x64.cxx         |    2 +-
 basic/source/runtime/dllmgr-x86.cxx         |    2 +-
 scaddins/source/analysis/analysishelper.cxx |    4 ++++
 scaddins/source/analysis/financial.cxx      |   20 ++++++++++++++++++++
 4 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 853167931600777e7bf44a35e051628a1169bcfc
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Sep 4 08:54:21 2013 +0300

    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

diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 05b6bbf..0012231 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 dd637c6..a34591a 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
 }
 
 
commit 37f1a6d35acd13ab356323637ecb2c8de076bf1c
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Sep 4 02:10:58 2013 +0300

    WaE: use number() instead of valueOf()
    
    Change-Id: Ic45dc030f76531d202a12e227130d11d3d1de805

diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index 7d3e291..d172833 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -624,7 +624,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
         }
         FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
         if (p != 0) {
-            proc->name = OString("#") + OString::valueOf(n);
+            proc->name = OString("#") + OString::number(n);
             proc->proc = p;
             return ERRCODE_NONE;
         }
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 2bfd037..60b3027 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -579,7 +579,7 @@ SbError getProcData(HMODULE handle, OUString const & name, ProcData * proc)
         }
         FARPROC p = GetProcAddress(handle, reinterpret_cast< LPCSTR >(n));
         if (p != 0) {
-            proc->name = OString("#") + OString::valueOf(n);
+            proc->name = OString("#") + OString::number(n);
             proc->proc = p;
             return ERRCODE_NONE;
         }


More information about the Libreoffice-commits mailing list