Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNicolas Viennot <Nicolas.Viennot@twosigma.com>2019-12-21 21:13:06 +0300
committerAndrei Vagin <avagin@gmail.com>2020-02-04 23:39:42 +0300
commit17c4a8b24507d1bd1a906aa4a9d5ea3054072141 (patch)
treed2f11a35430548513c210ab05d1d7b6f9772374f /test
parent8bb3c17a0f7f14baaed8d9b6ebf953c24a793ccc (diff)
style: Enforce kernel style -Wstrict-prototypes
Include warnings that the kernel uses during compilation: -Wstrict-prototypes: enforces full declaration of functions. Previously, when declaring extern void func(), one can call func(123) and have no compilation error. This is dangerous. The correct declaration is extern void func(void). Signed-off-by: Nicolas Viennot <Nicolas.Viennot@twosigma.com> [Generated a commit message from the pull request] Signed-off-by: Dmitry Safonov <dima@arista.com>
Diffstat (limited to 'test')
-rw-r--r--test/others/unix-callback/unix-client.c2
-rw-r--r--test/others/unix-callback/unix-server.c2
-rw-r--r--test/zdtm/Makefile.inc2
-rw-r--r--test/zdtm/lib/test.c6
-rw-r--r--test/zdtm/static/apparmor.c4
-rw-r--r--test/zdtm/static/child_subreaper_and_reparent.c6
-rw-r--r--test/zdtm/static/child_subreaper_existing_child.c6
-rw-r--r--test/zdtm/static/dumpable02.c2
-rw-r--r--test/zdtm/static/fdt_shared.c4
-rw-r--r--test/zdtm/static/file_locks00.c2
-rw-r--r--test/zdtm/static/inotify_system.c2
-rw-r--r--test/zdtm/static/maps00.c7
-rw-r--r--test/zdtm/static/selinux00.c8
-rw-r--r--test/zdtm/static/selinux01.c10
-rw-r--r--test/zdtm/static/session02.c8
-rw-r--r--test/zdtm/static/session03.c10
-rw-r--r--test/zdtm/transition/netlink00.c22
17 files changed, 52 insertions, 51 deletions
diff --git a/test/others/unix-callback/unix-client.c b/test/others/unix-callback/unix-client.c
index 69808b53c..676c4adbc 100644
--- a/test/others/unix-callback/unix-client.c
+++ b/test/others/unix-callback/unix-client.c
@@ -86,7 +86,7 @@ static int check_sock(int i)
return 0;
}
-int main()
+int main(void)
{
int i, fd;
sigset_t set;
diff --git a/test/others/unix-callback/unix-server.c b/test/others/unix-callback/unix-server.c
index 8f32f53dd..47bebd05d 100644
--- a/test/others/unix-callback/unix-server.c
+++ b/test/others/unix-callback/unix-server.c
@@ -19,7 +19,7 @@ struct ticket *tickets;
#define SK_NAME "/tmp/criu.unix.callback.test"
-int main()
+int main(void)
{
int sk, ret, id;
char buf[4096];
diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
index 6958d128e..43763321f 100644
--- a/test/zdtm/Makefile.inc
+++ b/test/zdtm/Makefile.inc
@@ -38,7 +38,7 @@ ifeq ($(origin CC), default)
CC := $(CROSS_COMPILE)$(HOSTCC)
endif
CFLAGS += -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
-CFLAGS += -Wdeclaration-after-statement
+CFLAGS += -Wdeclaration-after-statement -Wstrict-prototypes
CFLAGS += $(USERCFLAGS)
CFLAGS += -D_GNU_SOURCE
CPPFLAGS += -iquote $(LIBDIR)/arch/$(ARCH)/include
diff --git a/test/zdtm/lib/test.c b/test/zdtm/lib/test.c
index a1bdfc1b4..630476de0 100644
--- a/test/zdtm/lib/test.c
+++ b/test/zdtm/lib/test.c
@@ -71,7 +71,7 @@ static void test_fini(void)
unlinkat(cwd, pidfile, 0);
}
-static void setup_outfile()
+static void setup_outfile(void)
{
if (!access(outfile, F_OK) || errno != ENOENT) {
fprintf(stderr, "Output file %s appears to exist, aborting\n",
@@ -93,7 +93,7 @@ static void setup_outfile()
exit(1);
}
-static void redir_stdfds()
+static void redir_stdfds(void)
{
int nullfd;
@@ -346,7 +346,7 @@ void test_init(int argc, char **argv)
srand48(time(NULL)); /* just in case we need it */
}
-void test_daemon()
+void test_daemon(void)
{
futex_set_and_wake(&test_shared_state->stage, TEST_RUNNING_STAGE);
}
diff --git a/test/zdtm/static/apparmor.c b/test/zdtm/static/apparmor.c
index 15930c761..b3a4d7549 100644
--- a/test/zdtm/static/apparmor.c
+++ b/test/zdtm/static/apparmor.c
@@ -15,7 +15,7 @@ const char *test_author = "Tycho Andersen <tycho.andersen@canonical.com>";
#define PROFILE "criu_test"
-int setprofile()
+int setprofile(void)
{
char profile[1024];
int fd, len;
@@ -45,7 +45,7 @@ int setprofile()
return 0;
}
-int checkprofile()
+int checkprofile(void)
{
FILE *f;
char path[PATH_MAX], profile[1024];
diff --git a/test/zdtm/static/child_subreaper_and_reparent.c b/test/zdtm/static/child_subreaper_and_reparent.c
index 57943a67b..e3955d3d9 100644
--- a/test/zdtm/static/child_subreaper_and_reparent.c
+++ b/test/zdtm/static/child_subreaper_and_reparent.c
@@ -25,7 +25,7 @@ struct shared {
int parent_after_cr;
} *sh;
-int orphan()
+int orphan(void)
{
/*
* Wait until reparented to the pidns init. (By waiting
@@ -45,7 +45,7 @@ int orphan()
return 0;
}
-int helper()
+int helper(void)
{
int pid;
@@ -59,7 +59,7 @@ int helper()
return 0;
}
-int subreaper()
+int subreaper(void)
{
int pid, ret, status;
diff --git a/test/zdtm/static/child_subreaper_existing_child.c b/test/zdtm/static/child_subreaper_existing_child.c
index 28e9dbb8a..8291aba08 100644
--- a/test/zdtm/static/child_subreaper_existing_child.c
+++ b/test/zdtm/static/child_subreaper_existing_child.c
@@ -24,7 +24,7 @@ struct shared {
} *sh;
-int orphan()
+int orphan(void)
{
/* Return the control back to MAIN worker to do C/R */
futex_set_and_wake(&sh->fstate, TEST_CRIU);
@@ -36,7 +36,7 @@ int orphan()
return 0;
}
-int helper()
+int helper(void)
{
int pid;
@@ -52,7 +52,7 @@ int helper()
return 0;
}
-int subreaper()
+int subreaper(void)
{
int pid, ret, status;
diff --git a/test/zdtm/static/dumpable02.c b/test/zdtm/static/dumpable02.c
index 024371bd8..7e2eee2d1 100644
--- a/test/zdtm/static/dumpable02.c
+++ b/test/zdtm/static/dumpable02.c
@@ -13,7 +13,7 @@
const char *test_doc = "Check dumpable flag handling (non-dumpable case)";
const char *test_author = "Filipe Brandenburger <filbranden@google.com>";
-int dumpable_server() {
+int dumpable_server(void) {
char buf[256];
int ret;
diff --git a/test/zdtm/static/fdt_shared.c b/test/zdtm/static/fdt_shared.c
index 2111356f5..a84444af5 100644
--- a/test/zdtm/static/fdt_shared.c
+++ b/test/zdtm/static/fdt_shared.c
@@ -22,7 +22,7 @@ TEST_OPTION(filename, string, "file name", 1);
#define CHILDREN 4
static int fork_pfd[2];
-static void forked()
+static void forked(void)
{
char c = 0;
@@ -32,7 +32,7 @@ static void forked()
}
}
-static void wait_children()
+static void wait_children(void)
{
int i;
char c;
diff --git a/test/zdtm/static/file_locks00.c b/test/zdtm/static/file_locks00.c
index 59e19cfe1..fa98a31b3 100644
--- a/test/zdtm/static/file_locks00.c
+++ b/test/zdtm/static/file_locks00.c
@@ -101,7 +101,7 @@ static int check_write_lock(int fd, int whence, off_t offset, off_t len)
return -1;
}
-static int check_file_locks()
+static int check_file_locks(void)
{
int fd_0, fd_1;
int ret0, ret1;
diff --git a/test/zdtm/static/inotify_system.c b/test/zdtm/static/inotify_system.c
index 59f47c41c..3e6b2ad48 100644
--- a/test/zdtm/static/inotify_system.c
+++ b/test/zdtm/static/inotify_system.c
@@ -68,7 +68,7 @@ typedef struct {
int dir;
} desc;
-void do_wait() {
+void do_wait(void) {
test_daemon();
test_waitsig();
}
diff --git a/test/zdtm/static/maps00.c b/test/zdtm/static/maps00.c
index a6c68cd25..f2da9b975 100644
--- a/test/zdtm/static/maps00.c
+++ b/test/zdtm/static/maps00.c
@@ -123,7 +123,7 @@ static void segfault(int signo)
* after test func should be placed check map, because size of test_func
* is calculated as (check_map-test_func)
*/
-int test_func()
+int test_func(void)
{
return 1;
}
@@ -176,8 +176,9 @@ static int check_map(struct map *map)
memcpy(map->ptr,test_func, getpagesize());
} else {
if (!(map->flag & MAP_ANONYMOUS)) {
+ uint8_t funlen = (uint8_t *)check_map - (uint8_t *)test_func;
lseek(map->fd,0,SEEK_SET);
- if (write(map->fd,test_func,check_map - test_func)<check_map - test_func) {
+ if (write(map->fd,test_func,funlen)<funlen) {
pr_perror("failed to write %s", map->filename);
return -1;
}
@@ -185,7 +186,7 @@ static int check_map(struct map *map)
}
if (!(map->flag & MAP_ANONYMOUS) || map->prot & PROT_WRITE)
/* Function body has been copied into the mapping */
- ((int (*)())map->ptr)(); /* perform exec access */
+ ((int (*)(void))map->ptr)(); /* perform exec access */
else
/* No way to copy function body into mapping,
* clear exec bit from effective protection
diff --git a/test/zdtm/static/selinux00.c b/test/zdtm/static/selinux00.c
index db8420eac..b5b3e3cc0 100644
--- a/test/zdtm/static/selinux00.c
+++ b/test/zdtm/static/selinux00.c
@@ -26,14 +26,14 @@ const char *test_author = "Adrian Reber <areber@redhat.com>";
*/
char state;
-int check_for_selinux()
+int check_for_selinux(void)
{
if (access("/sys/fs/selinux", F_OK) == 0)
return 0;
return 1;
}
-int setprofile()
+int setprofile(void)
{
int fd, len;
@@ -54,7 +54,7 @@ int setprofile()
return 0;
}
-int checkprofile()
+int checkprofile(void)
{
int fd;
char context[1024];
@@ -83,7 +83,7 @@ int checkprofile()
return 0;
}
-int check_sockcreate()
+int check_sockcreate(void)
{
char *output = NULL;
FILE *f = fopen("/proc/self/attr/sockcreate", "r");
diff --git a/test/zdtm/static/selinux01.c b/test/zdtm/static/selinux01.c
index cec5980e8..cbf145d2a 100644
--- a/test/zdtm/static/selinux01.c
+++ b/test/zdtm/static/selinux01.c
@@ -28,14 +28,14 @@ const char *test_author = "Adrian Reber <areber@redhat.com>";
*/
char state;
-int check_for_selinux()
+int check_for_selinux(void)
{
if (access("/sys/fs/selinux", F_OK) == 0)
return 0;
return 1;
}
-int setprofile()
+int setprofile(void)
{
int fd, len;
@@ -56,7 +56,7 @@ int setprofile()
return 0;
}
-int set_sockcreate()
+int set_sockcreate(void)
{
int fd, len;
@@ -77,7 +77,7 @@ int set_sockcreate()
return 0;
}
-int check_sockcreate()
+int check_sockcreate(void)
{
int fd;
char context[1024];
@@ -106,7 +106,7 @@ int check_sockcreate()
return 0;
}
-int check_sockcreate_empty()
+int check_sockcreate_empty(void)
{
char *output = NULL;
FILE *f = fopen("/proc/self/attr/sockcreate", "r");
diff --git a/test/zdtm/static/session02.c b/test/zdtm/static/session02.c
index 37f245d2e..f5c81df16 100644
--- a/test/zdtm/static/session02.c
+++ b/test/zdtm/static/session02.c
@@ -25,7 +25,7 @@ struct process *processes;
int nr_processes = 20;
int current = 0;
-static void cleanup()
+static void cleanup(void)
{
int i;
@@ -55,9 +55,9 @@ struct command
int arg2;
};
-static void handle_command();
+static void handle_command(void);
-static void mainloop()
+static void mainloop(void)
{
while (1)
handle_command();
@@ -100,7 +100,7 @@ static int make_child(int id, int flags)
return cid;
}
-static void handle_command()
+static void handle_command(void)
{
int sk = processes[current].sks[0], ret, status = 0;
struct command cmd;
diff --git a/test/zdtm/static/session03.c b/test/zdtm/static/session03.c
index 2b3c46c32..8ca16e410 100644
--- a/test/zdtm/static/session03.c
+++ b/test/zdtm/static/session03.c
@@ -36,7 +36,7 @@ static void sigchld_handler(int signal, siginfo_t *siginfo, void *data)
waitpid(pid, NULL, WNOHANG);
}
-static void cleanup()
+static void cleanup(void)
{
int i, ret;
@@ -72,7 +72,7 @@ enum commands
int cmd_weght[TEST_MAX] = {10, 3, 1, 10, 7};
int sum_weight = 0;
-static int get_rnd_op()
+static int get_rnd_op(void)
{
int i, m;
if (sum_weight == 0) {
@@ -97,9 +97,9 @@ struct command
int arg2;
};
-static void handle_command();
+static void handle_command(void);
-static void mainloop()
+static void mainloop(void)
{
while (1)
handle_command();
@@ -142,7 +142,7 @@ static int make_child(int id, int flags)
return cid;
}
-static void handle_command()
+static void handle_command(void)
{
int sk = processes[current].sks[0], ret, status = 0;
struct command cmd;
diff --git a/test/zdtm/transition/netlink00.c b/test/zdtm/transition/netlink00.c
index c9b2303e8..3504a48a1 100644
--- a/test/zdtm/transition/netlink00.c
+++ b/test/zdtm/transition/netlink00.c
@@ -56,12 +56,12 @@ struct rtmsg *rtp;
int rtl;
struct rtattr *rtap;
-int send_request();
-int recv_reply();
-int form_request_add();
-int form_request_del();
-int read_reply();
-typedef int (*cmd_t)();
+int send_request(void);
+int recv_reply(void);
+int form_request_add(void);
+int form_request_del(void);
+int read_reply(void);
+typedef int (*cmd_t)(void);
#define CMD_NUM 2
cmd_t cmd[CMD_NUM]={form_request_add, form_request_del};
@@ -120,7 +120,7 @@ out:
return 0;
}
-int send_request()
+int send_request(void)
{
// create the remote address
// to communicate
@@ -145,7 +145,7 @@ int send_request()
}
return 0;
}
-int recv_reply()
+int recv_reply(void)
{
char *p;
// initialize the socket read buffer
@@ -191,7 +191,7 @@ int recv_reply()
return 0;
}
-int read_reply()
+int read_reply(void)
{
//string to hold content of the route
// table (i.e. one entry)
@@ -250,7 +250,7 @@ int read_reply()
#define NLMSG_TAIL(nmsg) \
((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
-int form_request_del()
+int form_request_del(void)
{
bzero(&req, sizeof(req));
req.nl.nlmsg_len = NLMSG_LENGTH(sizeof(struct rtmsg));
@@ -272,7 +272,7 @@ int form_request_del()
return 0;
}
-int form_request_add()
+int form_request_add(void)
{
int ifcn = 1; //interface number