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

Add support for GCC 14 condition coverage (MC/DC) #913

Open
sebhub opened this issue Apr 5, 2024 · 3 comments
Open

Add support for GCC 14 condition coverage (MC/DC) #913

sebhub opened this issue Apr 5, 2024 · 3 comments

Comments

@sebhub
Copy link

sebhub commented Apr 5, 2024

GCC 14 will support condition coverage:

https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fcondition-coverage

The corresponding GCC commit is:

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=08a52331803f66a4aaeaedd278436ca8eac57b50

Support was added to the gcov tool to show the condition coverage information:

https://gcc.gnu.org/onlinedocs/gcc/Invoking-Gcov.html

gcov --conditions:

        3:   17:void fn (int a, int b, int c, int d) {
        3:   18:    if ((a && (b || c)) && d)
conditions covered 3/8
condition  0 not covered (true false)
condition  1 not covered (true)
condition  2 not covered (true)
condition  3 not covered (true)
        1:   19:        x = 1;
        -:   20:    else
        2:   21:        x = 2;
        3:   22:}

gcov --conditions --json-format:

"conditions": [
    {
        "not_covered_false": [
            0
        ],
        "count": 8,
        "covered": 3,
        "not_covered_true": [
            0,
            1,
            2,
            3
        ]
    }
],

It would be nice if gcovr could also present this information.

@Spacetown
Copy link
Member

We're waiting already for the release of version 14 to finish #766

@Spacetown
Copy link
Member

@latk How shall we continue with the decision coverage? With gcc 14 this wouldn't be needed anymore.

@latk
Copy link
Member

latk commented Apr 7, 2024

With gcc 14 this wouldn't be needed anymore.

It will be quite some time until GCC 14 is widely used. Gcovr claims support for GCC 5.x (!), and Clang is also a thing.

It would be great to use this new GCC feature whenever available, but to continue supporting a reasonable range of other compilers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants