LO building fails with non debug mode on slideshow/source/engine/box2dtools.cxx (loplugin:staticmethods)

Stephan Bergmann sbergman at redhat.com
Sun Aug 16 19:16:34 UTC 2020


On 16/08/2020 18:55, Julien Nabet wrote:
> On pc Debian x86-64 with master sources updated today with non debug 
> build, I got these building errors:
> 
> In file included from 
> /home/julien/lo/libo_perf/slideshow/source/engine/box2dtools.cxx:10:
> /home/julien/lo/libo_perf/slideshow/source/inc/box2dtools.hxx:212:24: 
> error: this member function can be declared static [loplugin:staticmethods]
>      Box2DBodySharedPtr makeBodyDynamic(const Box2DBodySharedPtr& 
> pBox2DBody);
> ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/julien/lo/libo_perf/slideshow/source/engine/box2dtools.cxx:370:32: 
> note: defined here: [loplugin:staticmethods]
> Box2DBodySharedPtr box2DWorld::makeBodyDynamic(const Box2DBodySharedPtr& 
> pBox2DBody)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
> 
> In file included from 
> /home/julien/lo/libo_perf/slideshow/source/engine/box2dtools.cxx:10:
> /home/julien/lo/libo_perf/slideshow/source/inc/box2dtools.hxx:230:24: 
> error: this member function can be declared static [loplugin:staticmethods]
>      Box2DBodySharedPtr makeBodyStatic(const Box2DBodySharedPtr& 
> pBox2DBody);
> ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/julien/lo/libo_perf/slideshow/source/engine/box2dtools.cxx:387:32: 
> note: defined here: [loplugin:staticmethods]
> Box2DBodySharedPtr box2DWorld::makeBodyStatic(const Box2DBodySharedPtr& 
> pBox2DBody)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
> 
> 
> I don't reproduce this with my build containing enable-dbgutil because 
> the functions contain:
> 
> assert(mpBox2DWorld);

A general note, as such conditional cases of lopluign:staticmethods may 
be one of the more frustrating loplugin warnings to get cleaned up: 
Conditionally false positives can be silenced with something like

   (void) this; // avoid lopluign:staticmethods

in the member function's body, although 
<https://git.libreoffice.org/core/+/2e12d210cac8d031c21cdda9c37c1551f967ddc4%5E!> 
"Silence loplugin:staticmethods when the definition involves 
preprocessing" should already have reduced the likelihood of such 
conditionally false positives.

(In the given cases, though, it seems more plausible to get rid of the 
asserts, which appear to not state something of relevance for those 
functions, and indeed make them static member functions or even 
non-member functions.)



More information about the LibreOffice mailing list