Coverity musings

Jean-Marc Lasgouttes lasgouttes at lyx.org
Fri Sep 13 15:54:05 UTC 2024


Hi,

So I spent some quality time in front of Coverity and here is the 
result: since the start of this week, the number of outstanding defects 
is down from 246 to 87.

This is in addition to the 75 identical defects that got killed in one 
fell swoop last week.

How was that done?

* fixes, aka the commits you saw on the list. Several strategies here:

  - pass parameters as const references when possible. I did that even 
for shared_ptr<> objects, after reading a bit about this.

  - rewrite code to make sure that Coverity sees that nothing was wrong 
after all

  - Fix some actual bugs

* all the performance issues concerning string, docstring and QString, 
where we do a copy, and it would be possible to use std::move() instead, 
have been closed as "Ignored".

* some other copies of Qt objects which are known to use COW have been 
ignored too.



So what remains now?

* still lots of places where Coverity wants us to use std::move because 
the variable that is copied will not be used any more. I tend to think 
that we should avoid that and reduce our use of move() to the minimum, 
unless profiling shows that we have an issue. Do we have an agreement on 
that?

* Places where I understand the issue, but fixing requires some work and 
is a bit scary. Example in the patch below: Jürgen, could you please 
have a look and tell me why we should not do that? It is too simple, I 
fear I am missing something.

* Places where I understand the program, but am not sure of a proper fix.

* Places where I do not even understand what the issue is :(


Have a nice weekend.

JMarc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Streamline-use-of-map-col-type-bool.patch
Type: text/x-patch
Size: 6308 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20240913/2c519a12/attachment.bin>


More information about the lyx-devel mailing list