Hi Serg,

On Thu, Jul 29, 2021 at 9:57 AM Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Anel!

On Jul 29, Anel Husakovic wrote:
> Hi Serg,
> thanks for your review.
>
> > > +
> > > +my $gcc_version= `gcc -dumpversion`;
> > > +$gcc_version=~ s/(\d).*$/$1/;
> >
> > you don't need this second line, I suspect
> >
> It is not unique for all versions, that's why I used it:
>
> $ for i in 5 6 7 9 10; do $(/usr/bin/gcc-$i -dumpversion); done
> 5.5.0: command not found
> 6.5.0: command not found
> 7: command not found
> 9: command not found
> 10: command not found

I don't understand what you mean or what you're doing here.

I tried to show what is the output of `dumpversion` for various versions of gcc and why regex for the first digit is needed.
 
> > and write `my $fname` here
> >
> > > +      for my $line (@{$file->{lines}}){
> > > +        $cov{$fname}->{$line->{line_number}}= $line->{count};
> >
> > shouldn't it be += $line->{count} ?
> > The point is to accumulate all counters, see how it's done for non-json
> > intermediate format.
> >
> > > +      }
> > > +    }
> > >    }
> > >  }
> >
> Have seen  and I'm not sure how it accumulates since per line "line_number"
> value is different (I haven't seen 'lcount' to have the same
> line_number), so the hash is different and += doesn't take effect.

it's for the case like, say, THD::exit_cond() - an inline method defined
in sql_class.h. It's included in many .cc files and many *.gcov files
will have lcount data for it.

Make sense. Thanks.
Applied in  new patch: 85aa3f8cf66fd76addaa615dca507f

Regards,
Anel