[Libreoffice] Question about cppcheck "unused private"

Caolán McNamara caolanm at redhat.com
Wed Feb 16 12:43:21 PST 2011

On Sat, 2011-02-12 at 13:26 +0100, Julien Nabet wrote:
> Hello
> With the last git version of cppcheck, I've got in the master branch 
> writer/sw/source/ui/dbui this :
> [./dbmgr.cxx:222]: (style) Unused private function 
> 'SwConnectionDisposedListener_Impl::disposing'

> I don't understand these errors and so how to correct them.
> If it's a false positive cppcheck, I don't understand why.

So, this is basically one of a bunch of problems that cppcheck shows
because it's not able to find all the headers and so it can't tell that
the thing that dbmgr.cxx inherits from defines a public virtual void
disposing(); so it hopes for the best and notices that the disposing
here is in a "private" section and lets us know that from all cppcheck
can tell this is a private method that isn't called. Reduced test-case
attached if you want to report it.

But this is poor stylistically anyway so probably best to just fix it in
dbmgr.cxx by adding a public: before disposing and/or moving disposing
after private:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cxx
Type: text/x-c++src
Size: 187 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110216/be657307/attachment.cxx>

More information about the LibreOffice mailing list