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
This commit is contained in:
Kelvin M. Klann 2021-06-03 18:26:31 -03:00
parent e770ab6d85
commit 31557e9c77
14 changed files with 54 additions and 0 deletions

View file

@ -28,6 +28,10 @@
#include <linux/loop.h>
#include <errno.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
static char *devloop = NULL; // device file
static long unsigned size = 0; // offset into appimage file
#define MAXBUF 4096

View file

@ -29,6 +29,9 @@
#define O_PATH 010000000
#endif
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
// exit if error
void fs_check_chroot_dir(void) {

View file

@ -33,6 +33,10 @@
#define O_PATH 010000000
#endif
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
#define MAX_BUF 4096
#define EMPTY_STRING ("")
// check noblacklist statements not matched by a proper blacklist in disable-*.inc files

View file

@ -25,6 +25,9 @@
#include <sys/wait.h>
#include <string.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
static void check(const char *fname) {
// manufacture /run/user directory

View file

@ -31,6 +31,10 @@
//#include <stdio.h>
//#include <stdlib.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
// uid/gid cache
static uid_t c_uid = 0;
static char *c_uid_name = NULL;

View file

@ -44,6 +44,10 @@
#define O_PATH 010000000
#endif
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
#ifdef __ia64__
/* clone(2) has a different interface on ia64, as it needs to know
the size of the stack */

View file

@ -22,6 +22,11 @@
#include "../include/syscall.h"
#include <dirent.h>
#include <sys/stat.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
extern char *xephyr_screen;
#define MAX_READ 8192 // line buffer for profile files

View file

@ -21,6 +21,10 @@
#include <sys/time.h>
#include <sys/resource.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
void set_rlimits(void) {
EUID_ASSERT();
// resource limits

View file

@ -49,6 +49,9 @@
#include <sys/apparmor.h>
#endif
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
static int force_nonewprivs = 0;

View file

@ -41,6 +41,10 @@
#include <linux/openat2.h>
#endif
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
#define MAX_GROUPS 1024
#define MAXBUF 4098
#define EMPTY_STRING ("")

View file

@ -33,6 +33,10 @@
//#include <net/route.h>
//#include <linux/if_bridge.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
// print IP addresses for all interfaces
static void net_ifprint(void) {
uint32_t ip;

View file

@ -24,6 +24,10 @@
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
#define MAXBUF 4096
// ip -s link: device stats

View file

@ -30,6 +30,10 @@
#include <fcntl.h>
#include <sys/uio.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
#define PIDS_BUFLEN 4096
#define SERVER_PORT 889 // 889-899 is left unassigned by IANA

View file

@ -24,6 +24,10 @@
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_GCOV
#include <gcov.h>
#endif
static unsigned pgs_rss = 0;
static unsigned pgs_shared = 0;
static unsigned clocktick = 0;