[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - 8 commits - bridges/source config_host/config_gcc.h.in configure.ac filter/source include/vcl sw/inc sw/source vcl/headless vcl/source writerfilter/source

David Tardon dtardon at redhat.com
Wed Mar 19 06:50:42 PDT 2014


 bridges/source/cpp_uno/gcc3_linux_intel/except.cxx   |    9 --
 bridges/source/cpp_uno/gcc3_linux_intel/share.hxx    |   50 +++++++++++-----
 bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx  |    7 +-
 bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx  |    9 --
 bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx   |   51 +++++++++++-----
 bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx |    7 +-
 config_host/config_gcc.h.in                          |   19 ++++++
 configure.ac                                         |   34 ++++++++++
 filter/source/graphicfilter/ipbm/ipbm.cxx            |    6 -
 filter/source/graphicfilter/ipcd/ipcd.cxx            |    2 
 filter/source/graphicfilter/ipcx/ipcx.cxx            |    2 
 filter/source/graphicfilter/iras/iras.cxx            |    2 
 filter/source/graphicfilter/itga/itga.cxx            |    2 
 include/vcl/outdev.hxx                               |    6 +
 sw/inc/unotbl.hxx                                    |    2 
 sw/inc/viewsh.hxx                                    |    2 
 sw/source/core/inc/frame.hxx                         |    2 
 sw/source/core/inc/frmtool.hxx                       |    2 
 sw/source/core/unocore/unotbl.cxx                    |    2 
 sw/source/core/view/vprint.cxx                       |    2 
 vcl/headless/svptext.cxx                             |    2 
 vcl/source/gdi/outdev3.cxx                           |   59 +++++++++++++++++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx    |    6 +
 23 files changed, 214 insertions(+), 71 deletions(-)

New commits:
commit e36bdcea5a1b6a8fdd664142554ca94803c21bcd
Author: David Tardon <dtardon at redhat.com>
Date:   Wed Feb 5 10:55:25 2014 +0100

    rhbz#1057977 avoid use of invalidated pointers
    
    (cherry picked from commit 6b127d40c7d57745bc602d9ff7914392f9d3b92b)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>
    
    Conflicts:
    	vcl/source/gdi/outdev3.cxx
    
    Change-Id: Ib81f79da696b5e8002f5a2ddcf160903231dc3f1

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b3a2f9e..bf372e4 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -544,9 +544,15 @@ protected:
                         OutputDevice();
 
 private:
+    typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
+
     SAL_DLLPRIVATE                OutputDevice( const OutputDevice& rOutDev );
     SAL_DLLPRIVATE OutputDevice&  operator =( const OutputDevice& rOutDev );
 
+    SAL_DLLPRIVATE void         ImplClearFontData( bool bNewFontLists );
+    SAL_DLLPRIVATE void         ImplRefreshFontData( bool bNewFontLists );
+    SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
+
 public:
     virtual             ~OutputDevice();
 
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index e970c89..14707aa 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -156,7 +156,7 @@ static void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY,
     }
 }
 
-void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
+void OutputDevice::ImplClearFontData( const bool bNewFontLists )
 {
     // the currently selected logical font is no longer needed
     if ( mpFontEntry )
@@ -207,6 +207,38 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
                         delete mpFontList;
                     if( mpFontCache && mpFontCache != pSVData->maGDIData.mpScreenFontCache )
                         delete mpFontCache;
+                    mpFontList = 0;
+                    mpFontCache = 0;
+                }
+            }
+        }
+    }
+
+    // also update child windows if needed
+    if ( GetOutDevType() == OUTDEV_WINDOW )
+    {
+        Window* pChild = ((Window*)this)->mpWindowImpl->mpFirstChild;
+        while ( pChild )
+        {
+            pChild->ImplClearFontData( true );
+            pChild = pChild->mpWindowImpl->mpNext;
+        }
+    }
+}
+
+void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
+{
+//    if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
+    {
+        ImplSVData* pSVData = ImplGetSVData();
+
+        if ( bNewFontLists )
+        {
+            // we need a graphics
+            if ( ImplGetGraphics() )
+            {
+                if( mpPDFWriter )
+                {
                     mpFontList = mpPDFWriter->filterDevFontList( pSVData->maGDIData.mpScreenFontList );
                     mpFontCache = new ImplFontCache( sal_False );
                 }
@@ -227,16 +259,24 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
         Window* pChild = ((Window*)this)->mpWindowImpl->mpFirstChild;
         while ( pChild )
         {
-            pChild->ImplUpdateFontData( true );
+            pChild->ImplRefreshFontData( true );
             pChild = pChild->mpWindowImpl->mpNext;
         }
     }
 }
 
+void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
+{
+    ImplClearFontData( bNewFontLists );
+    ImplRefreshFontData( bNewFontLists );
+}
+
 void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
 {
     ImplSVData* pSVData = ImplGetSVData();
 
+    ImplUpdateFontDataForAllFrames( &OutputDevice::ImplClearFontData, bNewFontLists );
+
     // clear global font lists to have them updated
     pSVData->maGDIData.mpScreenFontCache->Invalidate();
     if ( bNewFontLists )
@@ -255,16 +295,23 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
         }
     }
 
+    ImplUpdateFontDataForAllFrames( &OutputDevice::ImplRefreshFontData, bNewFontLists );
+}
+
+void OutputDevice::ImplUpdateFontDataForAllFrames( const FontUpdateHandler_t pHdl, const bool bNewFontLists )
+{
+    ImplSVData* const pSVData = ImplGetSVData();
+
     // update all windows
     Window* pFrame = pSVData->maWinData.mpFirstFrame;
     while ( pFrame )
     {
-        pFrame->ImplUpdateFontData( bNewFontLists );
+        ( pFrame->*pHdl )( bNewFontLists );
 
         Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
         while ( pSysWin )
         {
-            pSysWin->ImplUpdateFontData( bNewFontLists );
+            ( pSysWin->*pHdl )( bNewFontLists );
             pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
         }
 
@@ -275,7 +322,7 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
     VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
     while ( pVirDev )
     {
-        pVirDev->ImplUpdateFontData( bNewFontLists );
+        ( pVirDev->*pHdl )( bNewFontLists );
         pVirDev = pVirDev->mpNext;
     }
 
@@ -283,7 +330,7 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
     Printer* pPrinter = pSVData->maGDIData.mpFirstPrinter;
     while ( pPrinter )
     {
-        pPrinter->ImplUpdateFontData( bNewFontLists );
+        ( pPrinter->*pHdl )( bNewFontLists );
         pPrinter = pPrinter->mpNext;
     }
 }
commit df6526a6fdcc9c157b7be5ce082615ec9838dccf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Nov 6 14:52:42 2013 +0000

    check for return of -1 from getToken
    
    as demonstrated by ooo91883-1.doc
    
    Change-Id: I11a7f0747334f4cecbfd34c9353598d875be02c2
    (cherry picked from commit 8f25d823a8d5488ae4880ae009a026f6fc07f611)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5e0c200..6f908a8 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1193,12 +1193,14 @@ util::DateTime lcl_DateStringToDateTime( const OUString& rDateTime )
     nIndex = 0;
     aDateTime.Year = sal_uInt16( sDate.getToken( 0, '-', nIndex ).toInt32() );
     aDateTime.Month = sal_uInt16( sDate.getToken( 0, '-', nIndex ).toInt32() );
-    aDateTime.Day = sal_uInt16( sDate.copy( nIndex ).toInt32() );
+    if (nIndex != -1)
+        aDateTime.Day = sal_uInt16( sDate.copy( nIndex ).toInt32() );
 
     nIndex = 0;
     aDateTime.Hours = sal_uInt16( sTime.getToken( 0, ':', nIndex ).toInt32() );
     aDateTime.Minutes = sal_uInt16( sTime.getToken( 0, ':', nIndex ).toInt32() );
-    aDateTime.Seconds = sal_uInt16( sTime.copy( nIndex ).toInt32() );
+    if (nIndex != -1)
+        aDateTime.Seconds = sal_uInt16( sTime.copy( nIndex ).toInt32() );
 
     return aDateTime;
 }
commit 956c34d5c0e0235d5124170a95dd3545d671abeb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 8 16:54:27 2013 +0200

    error: friend declaration specifying a default argument must be a definition
    
    ...(Clang trunk towards 3.4); this appears to be specific to C++11, which added at
    the end of 8.3.6/4 [dcl.fct.default]:  "If a friend declaration specifies a default
    argument expression, that declaration shall be a definition and shall be the only
    declaration of the function or function template in the translation unit."
    
    Change-Id: I750c60a2206d7af41322ebb31aa6deca2491067f
    (cherry picked from commit 39f42b0b03489459540404dd218c38709853c021)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>

diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index a8cc7b9..38aa412 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -71,7 +71,7 @@ class SwXCell : public SwXCellBaseClass,
     public SwClient
 {
     friend void   sw_setString( SwXCell &rCell, const OUString &rTxt,
-                                 sal_Bool bKeepNumberFmt = sal_False );
+                                 sal_Bool bKeepNumberFmt );
     friend double sw_getValue( SwXCell &rCell );
     friend void   sw_setValue( SwXCell &rCell, double nVal );
 
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index f3d867a..7fcd7d1 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -109,7 +109,7 @@ class SW_DLLPUBLIC ViewShell : public Ring
 
 
     // Set SwVisArea in order to enable clean formatting before printing.
-    friend void SetSwVisArea( ViewShell *pSh, const SwRect &, sal_Bool bPDFExport = sal_False );
+    friend void SetSwVisArea( ViewShell *pSh, const SwRect & );
 
     static BitmapEx*    mpReplaceBmp;    ///< replaced display of still loaded images
     static BitmapEx*    mpErrorBmp;      ///< error display of missed images
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index f93ae67..eeb84d8 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -234,7 +234,7 @@ class SwFrm: public SwClient, public SfxBroadcaster
     friend class SwLooping;
 
     // voids lower during creation of a column
-    friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL );
+    friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart );
     friend void   RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
 
 #ifdef DBG_UTIL
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index fc2e763..45b63bf 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -70,7 +70,7 @@ SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, ViewShell *pSh );
 
 sal_uLong SqRt( BigInt nX );
 
-SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart );
+SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart = NULL );
 void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow );
 
 // Get CntntNodes, create CntntFrms, and add them to LayFrm.
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 3fd2350..73c748b 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -692,7 +692,7 @@ static inline OUString lcl_getString( SwXCell &rCell )
 
 /*  non UNO function call to set string in SwXCell */
 void sw_setString( SwXCell &rCell, const OUString &rTxt,
-        sal_Bool bKeepNumberFmt )
+        sal_Bool bKeepNumberFmt = sal_False )
 {
     if(rCell.IsValid())
     {
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 6cea260..6f5f8ce8 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -172,7 +172,7 @@ void SwPaintQueue::Remove( ViewShell *pSh )
     }
 }
 
-void SetSwVisArea( ViewShell *pSh, const SwRect &rRect, sal_Bool /*bPDFExport*/ )
+void SetSwVisArea( ViewShell *pSh, const SwRect &rRect )
 {
     OSL_ENSURE( !pSh->GetWin(), "Drucken mit Window?" );
     pSh->maVisArea = rRect;
commit 7ed8aa0650a6d49117ef059a5f7c5dc472dccc14
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jul 8 13:40:12 2013 +0200

    error: comparison between pointer and integer (Clang trunk towards 3.4)
    
    ...the check in itga.cxx was useless anyway, as new[] does not return null.
    
    Change-Id: I4de5a46e14a83ab134d0a098a62748e909dc9c00
    (cherry picked from commit b63524d269a792e20777a91e4ed7e8ceae7ff55f)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>

diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx
index 4de5cef..ee9feb0 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -102,7 +102,7 @@ sal_Bool PBMReader::ReadPBM(Graphic & rGraphic )
     {
         case 0 :
             maBmp = Bitmap( Size( mnWidth, mnHeight ), 1 );
-            if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == sal_False )
+            if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == 0 )
                 return sal_False;
             mpAcc->SetPaletteEntryCount( 2 );
             mpAcc->SetPaletteColor( 0, BitmapColor( 0xff, 0xff, 0xff ) );
@@ -117,7 +117,7 @@ sal_Bool PBMReader::ReadPBM(Graphic & rGraphic )
             else
                 maBmp = Bitmap( Size( mnWidth, mnHeight ), 8);
 
-            if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == sal_False )
+            if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == 0 )
                 return sal_False;
             mnCol = (sal_uInt16)mnMaxVal + 1;
             if ( mnCol > 256 )
@@ -132,7 +132,7 @@ sal_Bool PBMReader::ReadPBM(Graphic & rGraphic )
             break;
         case 2 :
             maBmp = Bitmap( Size( mnWidth, mnHeight ), 24 );
-            if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == sal_False )
+            if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == 0 )
                 return sal_False;
             break;
     }
diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx
index 57178d8..b5be77d 100644
--- a/filter/source/graphicfilter/ipcd/ipcd.cxx
+++ b/filter/source/graphicfilter/ipcd/ipcd.cxx
@@ -151,7 +151,7 @@ sal_Bool PCDReader::ReadPCD( Graphic & rGraphic, FilterConfigItem* pConfigItem )
             nBMPHeight = nWidth;
         }
         aBmp = Bitmap( Size( nBMPWidth, nBMPHeight ), 24 );
-        if ( ( mpAcc = aBmp.AcquireWriteAccess() ) == sal_False )
+        if ( ( mpAcc = aBmp.AcquireWriteAccess() ) == 0 )
             return sal_False;
 
         ReadImage( 5 ,65 );
diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx
index 3738180..54579ff 100644
--- a/filter/source/graphicfilter/ipcx/ipcx.cxx
+++ b/filter/source/graphicfilter/ipcx/ipcx.cxx
@@ -100,7 +100,7 @@ sal_Bool PCXReader::ReadPCX(Graphic & rGraphic)
     if ( nStatus )
     {
         aBmp = Bitmap( Size( nWidth, nHeight ), nDestBitsPerPixel );
-        if ( ( pAcc = aBmp.AcquireWriteAccess() ) == sal_False )
+        if ( ( pAcc = aBmp.AcquireWriteAccess() ) == 0 )
             return sal_False;
 
         if ( nDestBitsPerPixel <= 8 )
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index 8add8e8..a1771e1 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -98,7 +98,7 @@ sal_Bool RASReader::ReadRAS(Graphic & rGraphic)
         return sal_False;
 
     maBmp = Bitmap( Size( mnWidth, mnHeight ), mnDstBitsPerPix );
-    if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == sal_False )
+    if ( ( mpAcc = maBmp.AcquireWriteAccess() ) == 0 )
         return sal_False;
 
     if ( mnDstBitsPerPix <= 8 )     // paletten bildchen
diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index 06220e3..8672029 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -732,8 +732,6 @@ sal_Bool TGAReader::ImplReadPalette()
             mpFileHeader->nColorMapEntrySize = 0x3f;    // patch for the following switch routine
         }
         mpColorMap = new sal_uInt32[ nColors ];     // we will always index dwords
-        if ( mpColorMap == sal_False )
-            return sal_False;                       // out of memory %&!$&/!"�$
 
         switch( mpFileHeader->nColorMapEntrySize )
         {
commit 959d95b5643f6f8f4254342fae238c2a636eba7a
Author: Luboš Luňák <l.lunak at centrum.cz>
Date:   Tue Mar 18 16:40:26 2014 +0100

    fix 'error: comparison between pointer and integer'
    
    Change-Id: I99df639d9df667c07f2756313bac6a78de607bee

diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 2b65746..f2a09af 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -172,7 +172,7 @@ void SvpGlyphPeer::RemovingFont( ServerFont& )
 
 void SvpGlyphPeer::RemovingGlyph( ServerFont&, GlyphData& rGlyphData, int /*nGlyphIndex*/ )
 {
-    if( rGlyphData.ExtDataRef().mpData != Format::NONE )
+    if( rGlyphData.ExtDataRef().mpData != 0 )
     {
         // release the glyph related resources
         DBG_ASSERT( (rGlyphData.ExtDataRef().meInfo <= Format::MAX), "SVP::RG() invalid alpha format" );
commit 6011795b73037555dda394c0ba6c3eadfae16654
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 20 15:58:58 2013 +0200

    ...and similarly for __cxa_allocate_exception and __cxa_throw
    
    (cherry picked from commit c17f01753ce94e9f57d6e4a2763152240fbcd50a)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>
    
    Conflicts:
    	configure.ac
    
    Change-Id: I87ae299aac97180f0587c553d85b051decca155c

diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
index 8229ce8..18a6eff 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
@@ -250,7 +250,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
             Reference< XInterface >() );
     }
 
-    pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
+    pCppExc = __cxxabiv1::__cxa_allocate_exception( pTypeDescr->nSize );
     ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
 
     // destruct uno exception
@@ -269,7 +269,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
     }
     }
 
-    __cxa_throw( pCppExc, rtti, deleteException );
+    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
 }
 
 //==================================================================================================
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
index f3f43e5..61702b7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
@@ -80,27 +80,30 @@ struct __cxa_eh_globals
 // Therefore, provide a declaration here for old GCC (libstdc++, really) version
 // that returns a void pointer, and in the code calling it always cast to the
 // above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which
-// hopefully keeps matching the real definition in libstdc++):
+// hopefully keeps matching the real definition in libstdc++); similarly for
+// __cxa_allocate_exception and __cxa_throw, though they do not have the
+// additional problem of an incompletely declared return type:
+
 #if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS
-namespace __cxxabiv1 { extern "C" void * __cxa_get_globals () throw(); }
+namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
 #endif
 
-namespace CPPU_CURRENT_NAMESPACE
-{
+#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
+namespace __cxxabiv1 {
+extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
+}
+#endif
 
-// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
-// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
-// declarations for them, e.g., with or without throw() specification, so would
-// complain about redeclarations of these somewhat implicitly declared
-// functions):
-#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
-extern "C" void *__cxa_allocate_exception(
-    std::size_t thrown_size ) throw();
-extern "C" void __cxa_throw (
-    void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
+#if !HAVE_GCC_CXXABI_H_CXA_THROW
+namespace __cxxabiv1 {
+extern "C" void __cxa_throw(
+    void * thrown_exception, void * tinfo, void (* dest)(void *))
+    __attribute__((noreturn));
+}
 #endif
 
-// -----
+namespace CPPU_CURRENT_NAMESPACE
+{
 
 //==================================================================================================
 void raiseException(
diff --git a/config_host/config_gcc.h.in b/config_host/config_gcc.h.in
index 4376877..c957179 100644
--- a/config_host/config_gcc.h.in
+++ b/config_host/config_gcc.h.in
@@ -10,7 +10,9 @@
 #ifndef CONFIG_GCC_H
 #define CONFIG_GCC_H
 
+#define HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION 0
 #define HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS 0
+#define HAVE_GCC_CXXABI_H_CXA_THROW 0
 
 #endif
 
diff --git a/configure.ac b/configure.ac
index 5b7a1d4..3b2a95b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5623,6 +5623,17 @@ if test "$GCC" = "yes"; then
         ], [AC_MSG_RESULT([no])])
     CFLAGS=$save_CFLAGS
 
+    AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+            #include <cxxabi.h>
+            void * f() { return __cxxabiv1::__cxa_allocate_exception(0); }
+        ])], [
+            AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION],[1])
+            AC_MSG_RESULT([yes])
+        ], [AC_MSG_RESULT([no])])
+    AC_LANG_POP([C++])
+
     AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
     AC_LANG_PUSH([C++])
     AC_COMPILE_IFELSE([AC_LANG_SOURCE([
@@ -5634,6 +5645,17 @@ if test "$GCC" = "yes"; then
         ], [AC_MSG_RESULT([no])])
     AC_LANG_POP([C++])
 
+    AC_MSG_CHECKING([whether $CXX declares __cxa_throw in cxxabi.h])
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+            #include <cxxabi.h>
+            void f() { __cxxabiv1::__cxa_throw(0, 0, 0); }
+        ])], [
+            AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_THROW],[1])
+            AC_MSG_RESULT([yes])
+        ], [AC_MSG_RESULT([no])])
+    AC_LANG_POP([C++])
+
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
 #else
commit f1fed0442127b2cc9e30711d4ecb2b1e251c8448
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Feb 14 15:04:50 2014 +0100

    Adapt gcc3_linux_intel to Clang 3.4
    
    ...same as 5ba3d1740b03efa394b2d2bf34fb8a8d3db2331d "Clean up declaration of
    __cxa_get_globals" plus c17f01753ce94e9f57d6e4a2763152240fbcd50a "...and
    similarly for __cxa_allocate_exception and __cxa_throw."
    
    Change-Id: I02361cfca260577ce13fb634b5637938daf0283d
    (cherry picked from commit 9dc337e9d073352cd9c9018d30b40bd4dcd5b1cb)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>

diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index 3eaceb4..6e7ed3d 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -22,11 +22,6 @@
 #include <dlfcn.h>
 #include <boost/unordered_map.hpp>
 
-#include <cxxabi.h>
-#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
-#define _GLIBCXX_CDTOR_CALLABI
-#endif
-
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <osl/diagnose.h>
@@ -248,7 +243,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
             Reference< XInterface >() );
     }
 
-    pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
+    pCppExc = __cxxabiv1::__cxa_allocate_exception( pTypeDescr->nSize );
     ::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
 
     // destruct uno exception
@@ -280,7 +275,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
     }
     }
 
-    __cxa_throw( pCppExc, rtti, deleteException );
+    __cxxabiv1::__cxa_throw( pCppExc, rtti, deleteException );
 }
 
 //==================================================================================================
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
index e37df21..4077d57 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/share.hxx
@@ -17,13 +17,20 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "uno/mapping.h"
+#include "sal/config.h"
 
 #include <typeinfo>
 #include <exception>
 #include <cstddef>
 
+#include <cxxabi.h>
+#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
+#define _GLIBCXX_CDTOR_CALLABI
+#endif
+
+#include "config_gcc.h"
 #include <uno/any2.h>
+#include "uno/mapping.h"
 
 namespace CPPU_CURRENT_NAMESPACE
 {
@@ -69,24 +76,37 @@ struct __cxa_eh_globals
 
 }
 
-extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
+// __cxa_get_globals is exported from libstdc++ since GCC 3.4.0 (CXXABI_1.3),
+// but it is only declared in cxxabi.h (in namespace __cxxabiv1) since
+// GCC 4.7.0.  It returns a pointer to a struct __cxa_eh_globals, but that
+// struct is only incompletely declared even in the GCC 4.7.0 cxxabi.h.
+// Therefore, provide a declaration here for old GCC (libstdc++, really) version
+// that returns a void pointer, and in the code calling it always cast to the
+// above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which
+// hopefully keeps matching the real definition in libstdc++); similarly for
+// __cxa_allocate_exception and __cxa_throw, though they do not have the
+// additional problem of an incompletely declared return type:
+
+#if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS
+namespace __cxxabiv1 { extern "C" void * __cxa_get_globals() throw(); }
+#endif
 
-namespace CPPU_CURRENT_NAMESPACE
-{
+#if !HAVE_GCC_CXXABI_H_CXA_ALLOCATE_EXCEPTION
+namespace __cxxabiv1 {
+extern "C" void * __cxa_allocate_exception(std::size_t thrown_size) throw();
+}
+#endif
 
-// The following are in cxxabi.h since GCC 4.7 (they are wrapped in
-// CPPU_CURRENT_NAMESPACE here as different GCC versions have slightly different
-// declarations for them, e.g., with or without throw() specification, so would
-// complain about redeclarations of these somewhat implicitly declared
-// functions):
-#if __GNUC__ == 4 && __GNUC_MINOR__ <= 6
-extern "C" void *__cxa_allocate_exception(
-    std::size_t thrown_size ) throw();
-extern "C" void __cxa_throw (
-    void *thrown_exception, void *tinfo, void (*dest) (void *) ) __attribute__((noreturn));
+#if !HAVE_GCC_CXXABI_H_CXA_THROW
+namespace __cxxabiv1 {
+extern "C" void __cxa_throw(
+    void * thrown_exception, void * tinfo, void (* dest)(void *))
+    __attribute__((noreturn));
+}
 #endif
 
-// -----
+namespace CPPU_CURRENT_NAMESPACE
+{
 
 //==================================================================================================
 void raiseException(
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
index 55a1250..783a090 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
@@ -202,8 +202,11 @@ static void cpp_call(
     }
      catch (...)
      {
-          // fill uno exception
-        fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+         // fill uno exception
+         fillUnoException(
+             reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >(
+                 __cxxabiv1::__cxa_get_globals())->caughtExceptions,
+             *ppUnoExc, pThis->getBridge()->getCpp2Uno());
 
         // temporary params
         for ( ; nTempIndizes--; )
commit 4d43792d9d003c37c2f1cd3c405c6ac7c5a2c58e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 20 13:57:45 2013 +0200

    Clean up declaration of __cxa_get_globals
    
    At least Clang trunk towards 3.4 now rejects incompatible declarations of the
    same extern "C" function in different namespaces, so that trick of getting at
    the function that is exported by libstdc++ but only rudimentarily if at all
    exposed in cxxabi.h no longer worked.
    
    TODO: This change should be reflected in any other bridges where it is relevant,
    too.
    
    (cherry picked from commit 5ba3d1740b03efa394b2d2bf34fb8a8d3db2331d)
    
    Signed-off-by: Luboš Luňák <l.lunak at centrum.cz>
    
    Conflicts:
    	configure.ac
    
    Change-Id: Ie3ccbdb7d75cc98636d02c0435958532620724f2

diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
index ea38f29..8229ce8 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx
@@ -22,11 +22,6 @@
 #include <string.h>
 #include <dlfcn.h>
 
-#include <cxxabi.h>
-#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
-#define _GLIBCXX_CDTOR_CALLABI
-#endif
-
 #include <boost/unordered_map.hpp>
 
 #include <rtl/strbuf.hxx>
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
index c305197..f3f43e5 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx
@@ -17,12 +17,20 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include "uno/mapping.h"
+#include "sal/config.h"
 
 #include <typeinfo>
 #include <exception>
 #include <cstddef>
 
+#include <cxxabi.h>
+#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
+#define _GLIBCXX_CDTOR_CALLABI
+#endif
+
+#include "config_gcc.h"
+#include "uno/mapping.h"
+
 namespace CPPU_CURRENT_NAMESPACE
 {
 
@@ -65,7 +73,17 @@ struct __cxa_eh_globals
 
 }
 
-extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
+// __cxa_get_globals is exported from libstdc++ since GCC 3.4.0 (CXXABI_1.3),
+// but it is only declared in cxxabi.h (in namespace __cxxabiv1) since
+// GCC 4.7.0.  It returns a pointer to a struct __cxa_eh_globals, but that
+// struct is only incompletely declared even in the GCC 4.7.0 cxxabi.h.
+// Therefore, provide a declaration here for old GCC (libstdc++, really) version
+// that returns a void pointer, and in the code calling it always cast to the
+// above fake definition of CPPU_CURRENT_NAMESPACE::__cxa_eh_globals (which
+// hopefully keeps matching the real definition in libstdc++):
+#if !HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS
+namespace __cxxabiv1 { extern "C" void * __cxa_get_globals () throw(); }
+#endif
 
 namespace CPPU_CURRENT_NAMESPACE
 {
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index cbf45bb..08c797c 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -289,8 +289,11 @@ static void cpp_call(
     }
      catch (...)
      {
-          // fill uno exception
-        fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
+         // fill uno exception
+         fillUnoException(
+             reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >(
+                 __cxxabiv1::__cxa_get_globals())->caughtExceptions,
+             *ppUnoExc, pThis->getBridge()->getCpp2Uno());
 
         // temporary params
         for ( ; nTempIndizes--; )
diff --git a/config_host/config_gcc.h.in b/config_host/config_gcc.h.in
new file mode 100644
index 0000000..4376877
--- /dev/null
+++ b/config_host/config_gcc.h.in
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef CONFIG_GCC_H
+#define CONFIG_GCC_H
+
+#define HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/configure.ac b/configure.ac
index ce5060b..5b7a1d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5623,6 +5623,17 @@ if test "$GCC" = "yes"; then
         ], [AC_MSG_RESULT([no])])
     CFLAGS=$save_CFLAGS
 
+    AC_MSG_CHECKING([whether $CXX declares __cxa_get_globals in cxxabi.h])
+    AC_LANG_PUSH([C++])
+    AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+            #include <cxxabi.h>
+            void * f() { return __cxxabiv1::__cxa_get_globals(); }
+        ])], [
+            AC_DEFINE([HAVE_GCC_CXXABI_H_CXA_GET_GLOBALS],[1])
+            AC_MSG_RESULT([yes])
+        ], [AC_MSG_RESULT([no])])
+    AC_LANG_POP([C++])
+
     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
 #if __GNUC__ == 4 && __GNUC_MINOR__ == 7 && (__GNUC_PATCHLEVEL__ == 0 || __GNUC_PATCHLEVEL__ == 1)
 #else
@@ -11976,6 +11987,7 @@ AC_CONFIG_FILES([config_host.mk Makefile lo.xcent instsetoo_native/util/openoffi
 AC_CONFIG_HEADERS([config_host/config_buildid.h])
 AC_CONFIG_HEADERS([config_host/config_clang.h])
 AC_CONFIG_HEADERS([config_host/config_features.h])
+AC_CONFIG_HEADERS([config_host/config_gcc.h])
 AC_CONFIG_HEADERS([config_host/config_global.h])
 AC_CONFIG_HEADERS([config_host/config_graphite.h])
 AC_CONFIG_HEADERS([config_host/config_lgpl.h])


More information about the Libreoffice-commits mailing list