Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue under gcov 8 where an un-hit section could overwrite a hit in templated code #315

Merged
merged 1 commit into from May 31, 2019

Conversation

@obiphi
Copy link
Contributor

obiphi commented May 31, 2019

Hi,

When working with GCC 8 (ref #228) I found a bug whereby if the gcov file is arranged thus:

------------------
Foo<int>::Foo():
function Foo<int>::Foo() called 1 returned 100% blocks executed 100%
        1:    7:  Foo(): b (1000) {}
------------------
Foo<char>::Foo():
function Foo<char>::Foo() called 0 returned 0% blocks executed 0%
    #####:    7:  Foo(): b (1000) {}
------------------

instead of:

------------------
Foo<char>::Foo():
function Foo<char>::Foo() called 0 returned 0% blocks executed 0%
    #####:    7:  Foo(): b (1000) {}
------------------
Foo<int>::Foo():
function Foo<int>::Foo() called 1 returned 100% blocks executed 100%
        1:    7:  Foo(): b (1000) {}
------------------

then the line in question is flagged as un-hit, because the un-hit indicator #### occurs after the hit indicator. In addition, if there are multiple instantiations of the template with different types only the hit count for the last one is used.

I've modified an existing test to demonstrate & test the first issue, and validated that the change fixes the issue I see in my code as well. I have done my best to understand and follow the contributions rules and have run the build under Travis CI to verify the changes I've made.

Please let me know if there are any other changes I can make to this PR to get it accepted.

Thanks,
Phil

…t section in templated code
@codecov

This comment has been minimized.

Copy link

codecov bot commented May 31, 2019

Codecov Report

Merging #315 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #315      +/-   ##
==========================================
+ Coverage   94.88%   94.89%   +<.01%     
==========================================
  Files          16       16              
  Lines        1878     1879       +1     
  Branches      328      328              
==========================================
+ Hits         1782     1783       +1     
  Misses         46       46              
  Partials       50       50
Impacted Files Coverage Δ
gcovr/gcov.py 86.98% <100%> (ø) ⬆️
gcovr/tests/test_gcov_parser.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ba5685...74d8618. Read the comment docs.

@latk
latk approved these changes May 31, 2019
@latk latk merged commit 1f5af01 into gcovr:master May 31, 2019
4 checks passed
4 checks passed
codecov/patch 100% of diff hit (target 94.88%)
Details
codecov/project 94.89% (+<.01%) compared to 8ba5685
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@latk

This comment has been minimized.

Copy link
Member

latk commented May 31, 2019

This looks excellent! Thank you for the fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.