[accidentally had dropped libreoffice@ from my original response]

-------- Original Message --------
Subject: Re: [PATCH] Some fixes for Clang warnings
Date: Mon, 23 Apr 2012 09:36:46 +0200
From: Stephan Bergmann <sberg...@redhat.com>
To: Catalin Iacob <iacobcata...@gmail.com>

On 04/22/2012 09:57 PM, Catalin Iacob wrote:
I tried to build with Clang and --enable-werror to see if that finds
any bugs. Attached are results so far; there is still quite some to
compile and Clang also consistently crashes on a file.

...reminds me of my stripped-down testcase for such a crash (see
attached test2.cc), which I did not yet follow up to.

diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 47ca98f..23d4871 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -987,7 +987,7 @@ inline void EnvironmentsData::registerEnvironment( 
uno_Environment ** ppEnv )
     if (iFind == aName2EnvMap.end())
     {
         (*pEnv->acquireWeak)( pEnv );
-        ::std::pair< OUString2EnvironmentMap::iterator, bool > insertion(
+        ::std::pair< OUString2EnvironmentMap::iterator, bool > insertion 
SAL_UNUSED_PARAMETER (

This one made me smile, as it cleverly reuses SAL_UNUSED_PARAMETER for
something it was not originally designed for.  However, I would prefer
to stick to the standard idiom

   (void) insertion; // avoid warnings

here (so that also compilers for which SAL_UNUSED_PARAMETER expands to
nothing can potentially benefit from the silenced warning), or, even
better, replace the following OSL_ENSURE with SAL_WARN or SAL_INFO
(which never expands to code that hides its arguments from the compiler).

SAL_UNUSED_PARAMETER was solely meant to annotate anonymous function
parameters that cannot be dropped (because the given function needs to
adhere to a certain function type).

Stephan

// /data/clang/inst/bin/clang -c test2.cc

template<typename T> struct SZ {};

template<typename T> struct S0 {
    S0(int = 0) {}

    S0(SZ<T>) {}
};

template<typename T> struct S1 {
    S1() { new S0<int>(); }
};

struct S2: S1<int> {
    S2() {}
};

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to