summaryrefslogtreecommitdiff
path: root/include/tools/ref.hxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-10-30 15:22:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-11-04 14:17:33 +0000
commit6f1c202547d087d1115ab023f9b6ee4c230c6602 (patch)
tree66cd1dd80b2f489ace1e749d1b6da2715032ed83 /include/tools/ref.hxx
parent6917797cc8bcef55c4d9a96cf4c4f47e7edb59a8 (diff)
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 <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/tools/ref.hxx')
-rw-r--r--include/tools/ref.hxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index e27277787cb3..45070a20a147 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; }