include/tools/ref.hxx |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 6f1c202547d087d1115ab023f9b6ee4c230c6602
Author: Michael Stahl <mst...@redhat.com>
Date:   Fri Oct 30 15:22:26 2015 +0100

    tools: re-order members of SvRefBase to work around clang 3.5 bug
    
    http://fpaste.org/285206/ has minimized reproducer
    
    Change-Id: I898dfe0c3246a4ee2b093559530db5446d31e8bc
    Reviewed-on: https://gerrit.libreoffice.org/19692
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index e272777..45070a2 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -92,21 +92,19 @@ protected:
 /** Classes that want to be referenced-counted via SvRef<T>, should extend 
this base class */
 class TOOLS_DLLPUBLIC SvRefBase
 {
+    // work around a clang 3.5 optimization bug: if the bNoDelete is *first*
+    // it mis-compiles "if (--nRefCount == 0)" and never deletes any object
+    unsigned int nRefCount : 31;
     // the only reason this is not bool is because MSVC cannot handle mixed 
type bitfields
-#if defined(__AFL_HAVE_MANUAL_INIT)
-    bool bNoDelete;
-#else
     unsigned int bNoDelete : 1;
-#endif
-    unsigned int nRefCount : 31;
 
 protected:
     virtual         ~SvRefBase();
 
 public:
-                    SvRefBase() : bNoDelete(1), nRefCount(0) {}
+                    SvRefBase() : nRefCount(0), bNoDelete(1) {}
 
-                    SvRefBase( const SvRefBase & /* rObj */ )  : bNoDelete(1), 
nRefCount(0) {}
+                    SvRefBase(const SvRefBase &) : nRefCount(0), bNoDelete(1) 
{}
 
     SvRefBase &     operator = ( const SvRefBase & )
                     { return *this; }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to