diff options
author | 2021-06-03 18:26:31 -0300 | |
---|---|---|
committer | 2021-06-18 14:48:56 -0300 | |
commit | 31557e9c770d9da7199a64f40f17f50a6686bcb1 (patch) | |
tree | c172939c5548c05409caf42955ba015a98480d53 | |
parent | appimage: automatically detect profile (diff) | |
download | firejail-31557e9c7.tar.gz firejail-31557e9c7.tar.zst firejail-31557e9c7.zip |
gcov: add missing gcov.h includes
Fixes the following "implicit declaration" warning (13 occurrences in
total) when building with gcov support:
$ pacman -Q gcc10
gcc10 1:10.2.0-3
$ CC=gcc-10 && export CC
$ ./configure --prefix=/usr --enable-apparmor --enable-gcov >/dev/null
$ make >/dev/null
appimage.c: In function ‘appimage_set’:
appimage.c:140:2: warning: implicit declaration of function ‘__gcov_flush’ [-Wimplicit-function-declaration]
140 | __gcov_flush();
| ^~~~~~~~~~~~
interface.c: In function ‘print_sandbox’:
interface.c:149:3: warning: implicit declaration of function ‘__gcov_flush’ [-Wimplicit-function-declaration]
149 | __gcov_flush();
| ^~~~~~~~~~~~
netstats.c: In function ‘netstats’:
netstats.c:246:4: warning: implicit declaration of function ‘__gcov_flush’ [-Wimplicit-function-declaration]
246 | __gcov_flush();
| ^~~~~~~~~~~~
[...]
Note: The commands above were executed from makepkg, while building
firejail-git from the AUR.
Note2: gcc-10 was used because the build fails with the current gcc
version (11.1.0) on Artix Linux. The failure happens because
__gcov_flush was removed on gcc 11.1.0[1]; this will be addressed later.
Note3: The following command helped find the affected files:
$ git grep -Fl __gcov -- src
[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=811b7636cb8c10f1a550a76242b5666c7ae36da2
-rw-r--r-- | src/firejail/appimage.c | 4 | ||||
-rw-r--r-- | src/firejail/chroot.c | 3 | ||||
-rw-r--r-- | src/firejail/fs.c | 4 | ||||
-rw-r--r-- | src/firejail/fs_mkdir.c | 3 | ||||
-rw-r--r-- | src/firejail/ls.c | 4 | ||||
-rw-r--r-- | src/firejail/main.c | 4 | ||||
-rw-r--r-- | src/firejail/profile.c | 5 | ||||
-rw-r--r-- | src/firejail/rlimit.c | 4 | ||||
-rw-r--r-- | src/firejail/sandbox.c | 3 | ||||
-rw-r--r-- | src/firejail/util.c | 4 | ||||
-rw-r--r-- | src/firemon/interface.c | 4 | ||||
-rw-r--r-- | src/firemon/netstats.c | 4 | ||||
-rw-r--r-- | src/firemon/procevent.c | 4 | ||||
-rw-r--r-- | src/firemon/top.c | 4 |
14 files changed, 54 insertions, 0 deletions
diff --git a/src/firejail/appimage.c b/src/firejail/appimage.c index d194eeafb..17e59d2ef 100644 --- a/src/firejail/appimage.c +++ b/src/firejail/appimage.c | |||
@@ -28,6 +28,10 @@ | |||
28 | #include <linux/loop.h> | 28 | #include <linux/loop.h> |
29 | #include <errno.h> | 29 | #include <errno.h> |
30 | 30 | ||
31 | #ifdef HAVE_GCOV | ||
32 | #include <gcov.h> | ||
33 | #endif | ||
34 | |||
31 | static char *devloop = NULL; // device file | 35 | static char *devloop = NULL; // device file |
32 | static long unsigned size = 0; // offset into appimage file | 36 | static long unsigned size = 0; // offset into appimage file |
33 | #define MAXBUF 4096 | 37 | #define MAXBUF 4096 |
diff --git a/src/firejail/chroot.c b/src/firejail/chroot.c index 05d89a866..edc31cdea 100644 --- a/src/firejail/chroot.c +++ b/src/firejail/chroot.c | |||
@@ -29,6 +29,9 @@ | |||
29 | #define O_PATH 010000000 | 29 | #define O_PATH 010000000 |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #ifdef HAVE_GCOV | ||
33 | #include <gcov.h> | ||
34 | #endif | ||
32 | 35 | ||
33 | // exit if error | 36 | // exit if error |
34 | void fs_check_chroot_dir(void) { | 37 | void fs_check_chroot_dir(void) { |
diff --git a/src/firejail/fs.c b/src/firejail/fs.c index bf78f8a17..e57038ee0 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c | |||
@@ -33,6 +33,10 @@ | |||
33 | #define O_PATH 010000000 | 33 | #define O_PATH 010000000 |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #ifdef HAVE_GCOV | ||
37 | #include <gcov.h> | ||
38 | #endif | ||
39 | |||
36 | #define MAX_BUF 4096 | 40 | #define MAX_BUF 4096 |
37 | #define EMPTY_STRING ("") | 41 | #define EMPTY_STRING ("") |
38 | // check noblacklist statements not matched by a proper blacklist in disable-*.inc files | 42 | // check noblacklist statements not matched by a proper blacklist in disable-*.inc files |
diff --git a/src/firejail/fs_mkdir.c b/src/firejail/fs_mkdir.c index 8cfeea582..bbc2aa938 100644 --- a/src/firejail/fs_mkdir.c +++ b/src/firejail/fs_mkdir.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <sys/wait.h> | 25 | #include <sys/wait.h> |
26 | #include <string.h> | 26 | #include <string.h> |
27 | 27 | ||
28 | #ifdef HAVE_GCOV | ||
29 | #include <gcov.h> | ||
30 | #endif | ||
28 | 31 | ||
29 | static void check(const char *fname) { | 32 | static void check(const char *fname) { |
30 | // manufacture /run/user directory | 33 | // manufacture /run/user directory |
diff --git a/src/firejail/ls.c b/src/firejail/ls.c index 796c42290..6ee557648 100644 --- a/src/firejail/ls.c +++ b/src/firejail/ls.c | |||
@@ -31,6 +31,10 @@ | |||
31 | //#include <stdio.h> | 31 | //#include <stdio.h> |
32 | //#include <stdlib.h> | 32 | //#include <stdlib.h> |
33 | 33 | ||
34 | #ifdef HAVE_GCOV | ||
35 | #include <gcov.h> | ||
36 | #endif | ||
37 | |||
34 | // uid/gid cache | 38 | // uid/gid cache |
35 | static uid_t c_uid = 0; | 39 | static uid_t c_uid = 0; |
36 | static char *c_uid_name = NULL; | 40 | static char *c_uid_name = NULL; |
diff --git a/src/firejail/main.c b/src/firejail/main.c index c6dda268d..02366a08c 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -44,6 +44,10 @@ | |||
44 | #define O_PATH 010000000 | 44 | #define O_PATH 010000000 |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #ifdef HAVE_GCOV | ||
48 | #include <gcov.h> | ||
49 | #endif | ||
50 | |||
47 | #ifdef __ia64__ | 51 | #ifdef __ia64__ |
48 | /* clone(2) has a different interface on ia64, as it needs to know | 52 | /* clone(2) has a different interface on ia64, as it needs to know |
49 | the size of the stack */ | 53 | the size of the stack */ |
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 40e4f788e..807a77bd7 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -22,6 +22,11 @@ | |||
22 | #include "../include/syscall.h" | 22 | #include "../include/syscall.h" |
23 | #include <dirent.h> | 23 | #include <dirent.h> |
24 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
25 | |||
26 | #ifdef HAVE_GCOV | ||
27 | #include <gcov.h> | ||
28 | #endif | ||
29 | |||
25 | extern char *xephyr_screen; | 30 | extern char *xephyr_screen; |
26 | 31 | ||
27 | #define MAX_READ 8192 // line buffer for profile files | 32 | #define MAX_READ 8192 // line buffer for profile files |
diff --git a/src/firejail/rlimit.c b/src/firejail/rlimit.c index 78f00bc63..dd6fec972 100644 --- a/src/firejail/rlimit.c +++ b/src/firejail/rlimit.c | |||
@@ -21,6 +21,10 @@ | |||
21 | #include <sys/time.h> | 21 | #include <sys/time.h> |
22 | #include <sys/resource.h> | 22 | #include <sys/resource.h> |
23 | 23 | ||
24 | #ifdef HAVE_GCOV | ||
25 | #include <gcov.h> | ||
26 | #endif | ||
27 | |||
24 | void set_rlimits(void) { | 28 | void set_rlimits(void) { |
25 | EUID_ASSERT(); | 29 | EUID_ASSERT(); |
26 | // resource limits | 30 | // resource limits |
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index a6bcec02c..e06ba3617 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -49,6 +49,9 @@ | |||
49 | #include <sys/apparmor.h> | 49 | #include <sys/apparmor.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #ifdef HAVE_GCOV | ||
53 | #include <gcov.h> | ||
54 | #endif | ||
52 | 55 | ||
53 | static int force_nonewprivs = 0; | 56 | static int force_nonewprivs = 0; |
54 | 57 | ||
diff --git a/src/firejail/util.c b/src/firejail/util.c index edd08bb41..47c367aad 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -41,6 +41,10 @@ | |||
41 | #include <linux/openat2.h> | 41 | #include <linux/openat2.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #ifdef HAVE_GCOV | ||
45 | #include <gcov.h> | ||
46 | #endif | ||
47 | |||
44 | #define MAX_GROUPS 1024 | 48 | #define MAX_GROUPS 1024 |
45 | #define MAXBUF 4098 | 49 | #define MAXBUF 4098 |
46 | #define EMPTY_STRING ("") | 50 | #define EMPTY_STRING ("") |
diff --git a/src/firemon/interface.c b/src/firemon/interface.c index e04b6f431..b93d4a5a2 100644 --- a/src/firemon/interface.c +++ b/src/firemon/interface.c | |||
@@ -33,6 +33,10 @@ | |||
33 | //#include <net/route.h> | 33 | //#include <net/route.h> |
34 | //#include <linux/if_bridge.h> | 34 | //#include <linux/if_bridge.h> |
35 | 35 | ||
36 | #ifdef HAVE_GCOV | ||
37 | #include <gcov.h> | ||
38 | #endif | ||
39 | |||
36 | // print IP addresses for all interfaces | 40 | // print IP addresses for all interfaces |
37 | static void net_ifprint(void) { | 41 | static void net_ifprint(void) { |
38 | uint32_t ip; | 42 | uint32_t ip; |
diff --git a/src/firemon/netstats.c b/src/firemon/netstats.c index 850959eb3..23d228e26 100644 --- a/src/firemon/netstats.c +++ b/src/firemon/netstats.c | |||
@@ -24,6 +24,10 @@ | |||
24 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | 26 | ||
27 | #ifdef HAVE_GCOV | ||
28 | #include <gcov.h> | ||
29 | #endif | ||
30 | |||
27 | #define MAXBUF 4096 | 31 | #define MAXBUF 4096 |
28 | 32 | ||
29 | // ip -s link: device stats | 33 | // ip -s link: device stats |
diff --git a/src/firemon/procevent.c b/src/firemon/procevent.c index 8085d2d29..4e809681e 100644 --- a/src/firemon/procevent.c +++ b/src/firemon/procevent.c | |||
@@ -30,6 +30,10 @@ | |||
30 | #include <fcntl.h> | 30 | #include <fcntl.h> |
31 | #include <sys/uio.h> | 31 | #include <sys/uio.h> |
32 | 32 | ||
33 | #ifdef HAVE_GCOV | ||
34 | #include <gcov.h> | ||
35 | #endif | ||
36 | |||
33 | #define PIDS_BUFLEN 4096 | 37 | #define PIDS_BUFLEN 4096 |
34 | #define SERVER_PORT 889 // 889-899 is left unassigned by IANA | 38 | #define SERVER_PORT 889 // 889-899 is left unassigned by IANA |
35 | 39 | ||
diff --git a/src/firemon/top.c b/src/firemon/top.c index a25e3c0d8..9d6f34991 100644 --- a/src/firemon/top.c +++ b/src/firemon/top.c | |||
@@ -24,6 +24,10 @@ | |||
24 | #include <sys/stat.h> | 24 | #include <sys/stat.h> |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | 26 | ||
27 | #ifdef HAVE_GCOV | ||
28 | #include <gcov.h> | ||
29 | #endif | ||
30 | |||
27 | static unsigned pgs_rss = 0; | 31 | static unsigned pgs_rss = 0; |
28 | static unsigned pgs_shared = 0; | 32 | static unsigned pgs_shared = 0; |
29 | static unsigned clocktick = 0; | 33 | static unsigned clocktick = 0; |