Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


[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 <sbergman@redhat.com>
To: Catalin Iacob <iacobcatalin@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() {}
};


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.