[PATCH] Some fixes for Clang warnings
sbergman at redhat.com
Mon Apr 23 04:24:34 PDT 2012
[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 at redhat.com>
To: Catalin Iacob <iacobcatalin at 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).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 255 bytes
Desc: not available
More information about the LibreOffice