1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 /* When built with --coverage (gcov) we need to explicitly call __gcov_dump()
5  * in places where we use _exit(), since _exit() skips at-exit hooks resulting
6  * in lost coverage.
7  *
8  * To make sure we don't miss any _exit() calls, this header file is included
9  * explicitly on the compiler command line via the -include directive (only
10  * when built with -Db_coverage=true)
11  * */
12 extern void _exit(int);
13 extern void __gcov_dump(void);
14 
_coverage__exit(int status)15 static inline void _coverage__exit(int status) {
16         __gcov_dump();
17         _exit(status);
18 }
19 #define _exit(x) _coverage__exit(x)
20