]>
Commit | Line | Data |
---|---|---|
b0d00302 FS |
1 | /* |
2 | * No copyright is claimed. This code is in the public domain; do with | |
3 | * it what you wish. | |
4 | */ | |
5 | #ifndef UTIL_LINUX_COVERAGE_H | |
6 | #define UTIL_LINUX_COVERAGE_H | |
7 | ||
8 | /* When built with --coverage (gcov) we need to explicitly call __gcov_dump() | |
9 | * in places where we use _exit(), since _exit() skips at-exit hooks resulting | |
10 | * in lost coverage. | |
11 | * | |
12 | * To make sure we don't miss any _exit() calls, this header file is included | |
13 | * explicitly on the compiler command line via the -include directive (only | |
14 | * when built with --coverage/-Db_coverage=true) | |
15 | */ | |
16 | void __gcov_dump(void); | |
17 | void _exit(int); | |
18 | ||
19 | __attribute__((noreturn)) static inline void _coverage__exit(int status) { | |
20 | __gcov_dump(); | |
21 | _exit(status); | |
22 | } | |
23 | #define _exit(x) _coverage__exit(x) | |
24 | ||
25 | #endif |