bazelbuild / bazelbuild/bazel

[coverage] Compiling by clang, and coverage report doesn't show the header files

Open
#26,913 2 comments 0 reactions 0 assignees View on GitHub
next_month team-Rules-CPP type: bug
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the bug:

if I use includes [] by -isystem to specify the header files, coverage report doesn't show it.

main.c:
```
#include
#include"gov.h"
int g_a = 10;
int main(){
printf("%d\n", foo(g_a));
return 0;
}
```
gg/gov.h:
```
static inline int foo(int a){
return -1;
}

include = [gg/gcov]
```
report:
```
1| |#include
2| |#include"gov.h"
3| |int g_a = 10;
4| 1|int main(){
5| 1| printf("%d\n", foo(g_a));
6| 1| return 0;
7| 1|}
8| |
```
During engineering-level compilation, if other C/CPP files include this header file using the -I option, it may lead to inaccurate coverage results.

Contributor guide

Open the contributing guide

Research direction

Reproduce the coverage report with main.c, gg/gov.h, the -isystem include, and the contrasting -I case. Then inspect Bazel's coverage compilation and report handling for headers; done means a regression test shows the affected header files accurately in the coverage output.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.