diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gcov_wrapper.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/include/gcov_wrapper.h b/src/include/gcov_wrapper.h new file mode 100644 index 000000000..2f409309d --- /dev/null +++ b/src/include/gcov_wrapper.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2021 Firejail Authors | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef GCOV_WRAPPER_H | ||
22 | #define GCOV_WRAPPER_H | ||
23 | |||
24 | #include <gcov.h> | ||
25 | |||
26 | /* | ||
27 | * __gcov_flush was removed on gcc 11.1.0 (as it's no longer needed), but it | ||
28 | * appears to be the safe/"correct" way to do things on previous versions (as | ||
29 | * it ensured proper locking, which is now done elsewhere). Thus, keep using | ||
30 | * it in the code and ensure that it exists, in order to support gcc <11.1.0 | ||
31 | * and gcc >=11.1.0, respectively. | ||
32 | */ | ||
33 | #if __GNUC__ > 11 || (__GNUC__ == 11 && __GNUC_MINOR__ >= 1) | ||
34 | static void __gcov_flush(void) { | ||
35 | __gcov_dump(); | ||
36 | __gcov_reset(); | ||
37 | } | ||
38 | #endif | ||
39 | |||
40 | #endif /* GCOV_WRAPPER_H */ | ||