docs: Exclude modules' `bench_impl.h` headers from coverage report #1722

pull hebasto wants to merge 4 commits into bitcoin-core:master from hebasto:250810-autotools-coverage changing 2 files +5 −3
  1. hebasto commented at 4:12 PM on August 10, 2025: member

    Additionally, this comment has been addressed.

  2. autotools, docs: Adjust help string for `--enable-coverage` option a9e955d3ea
  3. hebasto commented at 4:16 PM on August 10, 2025: member

    FWIW, on Ubuntu 24.04, when using GCC 13.3.0 and gcovr 7.0, I need to pass an extra --merge-mode-functions=separate option to generate a coverage report.

  4. real-or-random added the label assurance on Aug 11, 2025
  5. real-or-random added the label meta/development on Aug 11, 2025
  6. real-or-random commented at 9:01 AM on August 11, 2025: contributor

    FWIW, on Ubuntu 24.04, when using GCC 13.3.0 and gcovr 7.0, I need to pass an extra --merge-mode-functions=separate option to generate a coverage report.

    Let's add it, and I also need --gcov-suspicious-hits-threshold=140737488355330 (because we hit some lines in int128_impl.h more than 2^32 times...) but this was introduced only in gcovr 8.3. I assume older versions error out when they get this flag?

  7. doc: Exclude modules' `bench_impl.h` headers from coverage report 106a7cbf41
  8. doc: Add `--merge-mode-functions=separate` option to `gcovr` invocations
    Otherwise, commands fail with the error:
    ```
    Stderr of gcov was >><< End of stderr
    Exception was >>Got function secp256k1_scalar_split_lambda on multiple lines: 67, 142.
    	You can run gcovr with --merge-mode-functions=MERGE_MODE.
    	The available values for MERGE_MODE are described in the documentation.<< End of stderr
    ```
    1aecce5936
  9. hebasto force-pushed on Aug 11, 2025
  10. hebasto commented at 10:37 AM on August 11, 2025: member

    FWIW, on Ubuntu 24.04, when using GCC 13.3.0 and gcovr 7.0, I need to pass an extra --merge-mode-functions=separate option to generate a coverage report.

    Let's add it...

    Thanks! Done.

    ... and I also need --gcov-suspicious-hits-threshold=140737488355330 (because we hit some lines in int128_impl.h more than 2^32 times...) but this was introduced only in gcovr 8.3. I assume older versions error out when they get this flag?

    Yes, it outputs:

    usage: gcovr [options] [search_paths...]
    gcovr: error: unrecognized arguments: --gcov-suspicious-hits-threshold=140737488355330
    
  11. real-or-random commented at 12:06 PM on August 11, 2025: contributor

    Yes, it outputs:

    usage: gcovr [options] [search_paths...]
    gcovr: error: unrecognized arguments: --gcov-suspicious-hits-threshold=140737488355330
    

    Then I guess the best thing for now is to add a note/comment that this should be omitted on gcovr before 8.3.

  12. hebasto commented at 2:27 PM on August 11, 2025: member

    FWIW, on Ubuntu 24.04, when using GCC 13.3.0 and gcovr 7.0, I need to pass an extra --merge-mode-functions=separate option to generate a coverage report.

    Let's add it, and I also need --gcov-suspicious-hits-threshold=140737488355330 (because we hit some lines in int128_impl.h more than 2^32 times...) but this was introduced only in gcovr 8.3. I assume older versions error out when they get this flag?

    What GCC version are you using? Any other specific steps to reproduce the issue?

    EDIT: nm, I can reproduce it on Fedora 42 with GCC 15.1.1.

  13. real-or-random commented at 3:13 PM on August 11, 2025: contributor

    I think an alternative for <8.3 is --gcov-ignore-parse-errors=suspicious_hits.warn, which should work on >=6.0 if I understand the changelog correctly.

    Fwiw:

    gcovr 8.4.dev0+gfe536afac.d20250125
    gcc (GCC) 15.1.1 20250729
    
  14. hebasto commented at 3:25 PM on August 11, 2025: member

    I think an alternative for <8.3 is --gcov-ignore-parse-errors=suspicious_hits.warn, which should work on >=6.0 if I understand the changelog correctly.

    It was introduced in https://github.com/gcovr/gcovr/issues/898 and has been available since version 8.0.

    The --gcov-ignore-parse-errors=all option can be used instead.

  15. hebasto commented at 3:34 PM on August 11, 2025: member

    The --gcov-ignore-parse-errors=all option can be used instead.

    Taken this:

    $ gcovr --gcov-ignore-parse-errors=all --merge-mode-functions=separate --exclude 'src/bench*' --exclude 'src/modules/.*/bench_impl.h' --print-summary
    (INFO) Reading coverage data...
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE void secp256k1_u128_accum_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {'.
    (WARNING) Ignoring suspicious hits in line '   *r += (uint128_t)a * b;'.
    (WARNING) Ignoring suspicious hits in line '}'.
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE uint64_t secp256k1_u128_to_u64(const secp256k1_uint128 *a) {'.
    (WARNING) Ignoring suspicious hits in line '   return (uint64_t)(*a);'.
    (WARNING) Ignoring suspicious hits in line '                for (p = 0; p < 16; ++p) { /* p loops over the bit positions in mul2[j]. */'.
    (WARNING) Ignoring suspicious hits in line '                for (p = 0; p < 16; ++p) { /* p loops over the bit positions in mul2[j]. */'.
    (WARNING) Ignoring suspicious hits in line '                    int bitpos = j * 16 - i + p; /* bitpos is the correspond bit position in m. */'.
    (WARNING) Ignoring suspicious hits in line '                    if (bitpos >= 0 && bitpos < 256) {'.
    (WARNING) Ignoring suspicious hits in line '                    if (bitpos >= 0 && bitpos < 256) {'.
    (WARNING) Ignoring suspicious hits in line '                    if (bitpos >= 0 && bitpos < 256) {'.
    (WARNING) Ignoring suspicious hits in line '                        sub |= ((m[bitpos >> 4] >> (bitpos & 15)) & 1) << p;'.
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE void secp256k1_u128_accum_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {'.
    (WARNING) Ignoring suspicious hits in line '   *r += (uint128_t)a * b;'.
    (WARNING) Ignoring suspicious hits in line '}'.
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigned int n) {'.
    (WARNING) Ignoring suspicious hits in line '   *r >>= n;'.
    (WARNING) Ignoring suspicious hits in line '}'.
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE uint64_t secp256k1_u128_to_u64(const secp256k1_uint128 *a) {'.
    (WARNING) Ignoring suspicious hits in line '   return (uint64_t)(*a);'.
    (INFO) Writing coverage report...
    ------------------------------------------------------------------------------
                               GCC Code Coverage Report
    <snip>
    
  16. real-or-random commented at 7:51 AM on August 12, 2025: contributor

    lgtm but I suggest adding a note like this:

    On gcovr >=8.3, --gcov-ignore-parse-errors=all can be replaced with --gcov-suspicious-hits-threshold=140737488355330.

    Then we have a built-in reminder that we can remove the old argument in the future.

  17. doc: Add `--gcov-ignore-parse-errors=all` option to `gcovr` invocations
    Otherwise, commands might fail due to bugs in the `gcov` tool.
    0458def51e
  18. hebasto force-pushed on Aug 12, 2025
  19. hebasto commented at 8:12 AM on August 12, 2025: member

    lgtm but I suggest adding a note like this:

    On gcovr >=8.3, --gcov-ignore-parse-errors=all can be replaced with --gcov-suspicious-hits-threshold=140737488355330.

    Then we have a built-in reminder that we can remove the old argument in the future.

    Thanks! The note has been added.

  20. real-or-random approved
  21. real-or-random commented at 11:00 AM on August 12, 2025: contributor

    utACK 0458def51e18b7500dac8aec019b637dfade0667

  22. real-or-random commented at 11:09 AM on August 12, 2025: contributor

    @josibake Want to review this (with whatever tool versions you have on your system)?

  23. josibake commented at 8:42 AM on August 13, 2025: member

    Nice! Thanks for adding this, I ran into this recently and added --gcov-ignore-parse-errors=all after some googling. When I run with --gcov-ignore-parse-errors=all with gcovr@8.3, I see the following warnings:

    gcovr --gcov-ignore-parse-errors=all --merge-mode-functions=separate --exclude 'src/bench*' --exclude 'src/modules/.*/bench_impl.h' --print-summary
    (INFO) Reading coverage data...
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE void secp256k1_u128_accum_mul(secp256k1_uint128 *r, uint64_t a, uint64_t b) {'.
    (WARNING) Ignoring suspicious hits in line '   *r += (uint128_t)a * b;'.
    (WARNING) Ignoring suspicious hits in line '}'.
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE void secp256k1_u128_rshift(secp256k1_uint128 *r, unsigned int n) {'.
    (WARNING) Ignoring suspicious hits in line '   *r >>= n;'.
    (WARNING) Ignoring suspicious hits in line '}'.
    (WARNING) Ignoring suspicious hits in line 'static SECP256K1_INLINE uint64_t secp256k1_u128_to_u64(const secp256k1_uint128 *a) {'.
    (WARNING) Ignoring suspicious hits in line '   return (uint64_t)(*a);'.
    (INFO) Writing coverage report...
    ------------------------------------------------------------------------------
                               GCC Code Coverage Report
    Directory: .
    ------------------------------------------------------------------------------
    <snip>
    

    The warning goes away when running with --gcov-suspicious-hits-threshold=140737488355330, i.e.:

    gcovr --gcov-suspicious-hits-threshold=140737488355330 --merge-mode-functions=separate --exclude 'src/bench*' --exclude 'src/modules/.*/bench_impl.h' --print-summary
    (INFO) Reading coverage data...
    (INFO) Writing coverage report...
    ------------------------------------------------------------------------------
                               GCC Code Coverage Report
    Directory: .
    ------------------------------------------------------------------------------
    <snip>
    

    Also confirmed I got the same coverage report with both flags.

  24. josibake approved
  25. josibake commented at 8:44 AM on August 13, 2025: member

    ACK https://github.com/bitcoin-core/secp256k1/pull/1722/commits/0458def51e18b7500dac8aec019b637dfade0667

    Tested with gcovr@8.3 and confirmed I get a warning with the old flag (--gcovr-ignore-parse-errors=all), and that those warnings go away when running with the new flag suggest for gcovr >= 8.3

  26. real-or-random merged this on Aug 13, 2025
  27. real-or-random closed this on Aug 13, 2025

  28. hebasto deleted the branch on Aug 13, 2025
  29. vmta referenced this in commit 2b25f561a0 on Sep 21, 2025
  30. fanquake referenced this in commit 42c7d35d3a on Oct 14, 2025
  31. fanquake referenced this in commit 3cbf7cb3e6 on Oct 15, 2025
  32. Sjors referenced this in commit d5660d3a13 on Feb 16, 2026
  33. real-or-random referenced this in commit 42ae776d3b on Feb 25, 2026
  34. github-actions[bot] referenced this in commit c3f80fff5f on Mar 1, 2026
  35. github-actions[bot] referenced this in commit 758d4e90b4 on Mar 1, 2026
  36. github-actions[bot] referenced this in commit 4aeff8400e on Mar 1, 2026
  37. github-actions[bot] referenced this in commit 68a2178f22 on Mar 1, 2026
  38. github-actions[bot] referenced this in commit a8bc1a0b2b on Mar 1, 2026
  39. github-actions[bot] referenced this in commit 5f15eb0c55 on Mar 1, 2026
  40. 0x000000000019d6689c085ae165831e934ff76 referenced this in commit d54574beca on Mar 2, 2026
  41. 0x000000000019d6689c085ae165831e934ff76 referenced this in commit 3b9450150d on Mar 2, 2026
  42. csjones referenced this in commit fb3e16af04 on Mar 2, 2026
  43. csjones referenced this in commit a4d92824ae on Mar 2, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:52 UTC