cppcheck warnings... Mostly fixed, but not few one...

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

cppcheck warnings... Mostly fixed, but not few one...

Gilles Caulier-4
Hi all,

I very well advanced with cppcheck static analyzer reports review, and i fixed around 300 entries since 2 weeks...

But, as usual, the mostly difficult task is always at end, and the last reports sound like... special...

Look this one :


If we have really an error here, digiKam will crash very quickly when an image is open with DImg container. A false positive ?

And what's about these 4 entries about equality operator :


And definitively, i lost with these one :


Where these virtual calls appears in source code ?

Any tips, viewpoints, and guidance ?

Best

Gilles Caulier
Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Maik Qualmann
Yes, this is false positive, The assignment to d is in the inline function
assigne(o).

Maik

> Look this one :
>
> https://www.digikam.org/reports/cppcheck/master/27.html#line-195
>
> If we have really an error here, digiKam will crash very quickly when an
> image is open with DImg container. A false positive ?




Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Maik Qualmann
In reply to this post by Gilles Caulier-4
Here I see no solution, if the assigned object is 0 we have completely
different problems, it would crash anyway. What should the error handling look
like, not assign new object and keep old object is just as fatal? Try to
create a new object? We would have to look how it is solved elsewhere.

Maik

Am Donnerstag, 17. Mai 2018, 19:19:47 CEST schrieb Gilles Caulier:
> And what's about these 4 entries about equality operator :
>
> https://www.digikam.org/reports/cppcheck/master/17.html#line-90
> https://www.digikam.org/reports/cppcheck/master/48.html#line-179
> https://www.digikam.org/reports/cppcheck/master/83.html#line-55
> https://www.digikam.org/reports/cppcheck/master/94.html#line-531




Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Gilles Caulier-4
In reply to this post by Gilles Caulier-4
Look also the noExplicitConstructor entries :


Currently, with Krazy static analyzer, i disable the warnings, and all re-appear with cppcheck.

This is a tedious problem. Try to force a missing explicit constructor, as :



From Face Management code, and you will see a lots of errors.

Typically, the right constructor choice is delegate to the compiler, and the state at run time can be undefined. This is especially the case for contructor with one argument or more than one but with 2nd, 3rd, etc... using default values.

I already fixed some simple case, but it's the hell to apply fix everywhere, and i'm sure that side effect are introduced without explicit specifier.

More details here :


Gilles

2018-05-17 19:19 GMT+02:00 Gilles Caulier <[hidden email]>:
Hi all,

I very well advanced with cppcheck static analyzer reports review, and i fixed around 300 entries since 2 weeks...

But, as usual, the mostly difficult task is always at end, and the last reports sound like... special...

Look this one :


If we have really an error here, digiKam will crash very quickly when an image is open with DImg container. A false positive ?

And what's about these 4 entries about equality operator :


And definitively, i lost with these one :


Where these virtual calls appears in source code ?

Any tips, viewpoints, and guidance ?

Best

Gilles Caulier

Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Gilles Caulier-4
The noConstructor warnings are all false positive as i can see, or i don't understand the warning description.

Gilles

2018-05-17 21:59 GMT+02:00 Gilles Caulier <[hidden email]>:
Look also the noExplicitConstructor entries :


Currently, with Krazy static analyzer, i disable the warnings, and all re-appear with cppcheck.

This is a tedious problem. Try to force a missing explicit constructor, as :



From Face Management code, and you will see a lots of errors.

Typically, the right constructor choice is delegate to the compiler, and the state at run time can be undefined. This is especially the case for contructor with one argument or more than one but with 2nd, 3rd, etc... using default values.

I already fixed some simple case, but it's the hell to apply fix everywhere, and i'm sure that side effect are introduced without explicit specifier.

More details here :


Gilles

2018-05-17 19:19 GMT+02:00 Gilles Caulier <[hidden email]>:
Hi all,

I very well advanced with cppcheck static analyzer reports review, and i fixed around 300 entries since 2 weeks...

But, as usual, the mostly difficult task is always at end, and the last reports sound like... special...

Look this one :


If we have really an error here, digiKam will crash very quickly when an image is open with DImg container. A false positive ?

And what's about these 4 entries about equality operator :


And definitively, i lost with these one :


Where these virtual calls appears in source code ?

Any tips, viewpoints, and guidance ?

Best

Gilles Caulier


Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Gilles Caulier-4
As i can see too, the noCopyConstructor are mostly false positive, excepted for some cases where this king of constructor must be explicit and not delegate to the compiler. There are a lots of reports, and to review all will take a while.

Gilles

2018-05-17 22:00 GMT+02:00 Gilles Caulier <[hidden email]>:
The noConstructor warnings are all false positive as i can see, or i don't understand the warning description.

Gilles

2018-05-17 21:59 GMT+02:00 Gilles Caulier <[hidden email]>:
Look also the noExplicitConstructor entries :


Currently, with Krazy static analyzer, i disable the warnings, and all re-appear with cppcheck.

This is a tedious problem. Try to force a missing explicit constructor, as :



From Face Management code, and you will see a lots of errors.

Typically, the right constructor choice is delegate to the compiler, and the state at run time can be undefined. This is especially the case for contructor with one argument or more than one but with 2nd, 3rd, etc... using default values.

I already fixed some simple case, but it's the hell to apply fix everywhere, and i'm sure that side effect are introduced without explicit specifier.

More details here :


Gilles

2018-05-17 19:19 GMT+02:00 Gilles Caulier <[hidden email]>:
Hi all,

I very well advanced with cppcheck static analyzer reports review, and i fixed around 300 entries since 2 weeks...

But, as usual, the mostly difficult task is always at end, and the last reports sound like... special...

Look this one :


If we have really an error here, digiKam will crash very quickly when an image is open with DImg container. A false positive ?

And what's about these 4 entries about equality operator :


And definitively, i lost with these one :


Where these virtual calls appears in source code ?

Any tips, viewpoints, and guidance ?

Best

Gilles Caulier



Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Gilles Caulier-4
Look also the clang static analyzer reports. I fixed 90% of all entries, but some items still obscur. These one are the most important :



Gilles

2018-05-17 22:02 GMT+02:00 Gilles Caulier <[hidden email]>:
As i can see too, the noCopyConstructor are mostly false positive, excepted for some cases where this king of constructor must be explicit and not delegate to the compiler. There are a lots of reports, and to review all will take a while.

Gilles

2018-05-17 22:00 GMT+02:00 Gilles Caulier <[hidden email]>:
The noConstructor warnings are all false positive as i can see, or i don't understand the warning description.

Gilles

2018-05-17 21:59 GMT+02:00 Gilles Caulier <[hidden email]>:
Look also the noExplicitConstructor entries :


Currently, with Krazy static analyzer, i disable the warnings, and all re-appear with cppcheck.

This is a tedious problem. Try to force a missing explicit constructor, as :



From Face Management code, and you will see a lots of errors.

Typically, the right constructor choice is delegate to the compiler, and the state at run time can be undefined. This is especially the case for contructor with one argument or more than one but with 2nd, 3rd, etc... using default values.

I already fixed some simple case, but it's the hell to apply fix everywhere, and i'm sure that side effect are introduced without explicit specifier.

More details here :


Gilles

2018-05-17 19:19 GMT+02:00 Gilles Caulier <[hidden email]>:
Hi all,

I very well advanced with cppcheck static analyzer reports review, and i fixed around 300 entries since 2 weeks...

But, as usual, the mostly difficult task is always at end, and the last reports sound like... special...

Look this one :


If we have really an error here, digiKam will crash very quickly when an image is open with DImg container. A false positive ?

And what's about these 4 entries about equality operator :


And definitively, i lost with these one :


Where these virtual calls appears in source code ?

Any tips, viewpoints, and guidance ?

Best

Gilles Caulier




Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Maik Qualmann
In reply to this post by Gilles Caulier-4
I think this patch could be the solution. But I do not think the compiler or
there runtime problems exist by the current solution.

Maik

Am Donnerstag, 17. Mai 2018, 21:59:11 CEST schrieb Gilles Caulier:
> Currently, with Krazy static analyzer, i disable the warnings, and all
> re-appear with cppcheck.
>
> This is a tedious problem. Try to force a missing explicit constructor, as :
>
> https://www.digikam.org/reports/cppcheck/master/93.html#line-73
>
> https://www.digikam.org/reports/cppcheck/master/93.html#line-89


facepipeline.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cppcheck warnings... Mostly fixed, but not few one...

Bugzilla from kare.sars@iki.fi
In reply to this post by Gilles Caulier-4
Hi,

On torsdag 17 maj 2018 kl. 20:19:47 EEST Gilles Caulier wrote:

> Hi all,
>
> I very well advanced with cppcheck static analyzer reports review, and i
> fixed around 300 entries since 2 weeks...
>
> But, as usual, the mostly difficult task is always at end, and the last
> reports sound like... special...
>
> Look this one :
>
> https://www.digikam.org/reports/cppcheck/master/27.html#line-195
>
> If we have really an error here, digiKam will crash very quickly when an
> image is open with DImg container. A false positive ?

I guess the situation is that you do not make copies of the LensFunInterface
instances and that's why you do not get any crashes. A d-pointer class very
seldom is an object that you add to containers like QVectors and QLists so I
don't think it is a problem.

What you could do is to explicitly disable the copy-constructor and that would
also shut up the warning at the same time.


/Kåre