From de950994b2238c2568602dd2a7ac40e827e3d8c6 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Tue, 14 Aug 2018 21:31:17 +0200 Subject: Change the way unused arguments are handled Use the __unused macro when declaring unused arguments in function definitions. Use main(void) instead of main(argc, argv) where appropriate. --- src/shell.c | 5 +---- test/test_avltree.c | 5 +---- test/test_fmt_sscanf.c | 5 +---- test/test_plist.c | 5 +---- test/test_rbtree.c | 5 +---- test/test_rdxtree.c | 5 +---- test/test_shell.c | 19 +++++-------------- 7 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/shell.c b/src/shell.c index 114d089..e99766e 100644 --- a/src/shell.c +++ b/src/shell.c @@ -523,11 +523,8 @@ shell_cb_help(struct shell *shell, int argc, char *argv[]) } static void -shell_cb_history(struct shell *shell, int argc, char *argv[]) +shell_cb_history(struct shell *shell, int argc __unused, char *argv[] __unused) { - (void)argc; - (void)argv; - shell_history_print(shell_get_history(shell), shell); } diff --git a/test/test_avltree.c b/test/test_avltree.c index d5c5a9d..a65d5f1 100644 --- a/test/test_avltree.c +++ b/test/test_avltree.c @@ -97,7 +97,7 @@ get_id(int i) } int -main(int argc, char *argv[]) +main(void) { struct avltree tree; struct avltree_node *node, *tmp; @@ -105,9 +105,6 @@ main(int argc, char *argv[]) avltree_slot_t slot; int i, id; - (void)argc; - (void)argv; - avltree_init(&tree); for (i = 0; i < SIZE; i++) { diff --git a/test/test_fmt_sscanf.c b/test/test_fmt_sscanf.c index 3c16a56..3303034 100644 --- a/test/test_fmt_sscanf.c +++ b/test/test_fmt_sscanf.c @@ -739,11 +739,8 @@ test_42(void) } int -main(int argc, char *argv[]) +main(void) { - (void)argc; - (void)argv; - test_1(); test_2(); test_3(); diff --git a/test/test_plist.c b/test/test_plist.c index 1fea443..18578ff 100644 --- a/test/test_plist.c +++ b/test/test_plist.c @@ -79,14 +79,11 @@ print_list(const struct plist *list) } int -main(int argc, char *argv[]) +main(void) { struct obj *obj, *tmp; unsigned int prev_priority __attribute__((unused)); - (void)argc; - (void)argv; - add_obj(&obj_list, 1); add_obj(&obj_list, 3); obj = plist_first_entry(&obj_list, struct obj, node); diff --git a/test/test_rbtree.c b/test/test_rbtree.c index 090d760..ab48a6c 100644 --- a/test/test_rbtree.c +++ b/test/test_rbtree.c @@ -82,7 +82,7 @@ get_id(int i) } int -main(int argc, char *argv[]) +main(void) { struct rbtree tree; struct rbtree_node *node, *tmp; @@ -90,9 +90,6 @@ main(int argc, char *argv[]) rbtree_slot_t slot; int i, id; - (void)argc; - (void)argv; - rbtree_init(&tree); for (i = 0; i < SIZE; i++) { diff --git a/test/test_rdxtree.c b/test/test_rdxtree.c index 261cd58..4f4288c 100644 --- a/test/test_rdxtree.c +++ b/test/test_rdxtree.c @@ -1038,11 +1038,8 @@ test_38(void) } int -main(int argc, char *argv[]) +main(void) { - (void)argc; - (void)argv; - test_1(); test_2(); test_3(); diff --git a/test/test_shell.c b/test/test_shell.c index 4593b0e..79dac6c 100644 --- a/test/test_shell.c +++ b/test/test_shell.c @@ -68,22 +68,16 @@ test_exit(void) } static void -test_shell_exit(struct shell *shell, int argc, char *argv[]) +test_shell_exit(struct shell *shell __unused, int argc __unused, + char *argv[] __unused) { - (void)shell; - (void)argc; - (void)argv; - test_exit(); } static void -test_shell_top(struct shell *shell, int argc, char *argv[]) +test_shell_top(struct shell *shell __unused, int argc __unused, + char *argv[] __unused) { - (void)shell; - (void)argc; - (void)argv; - system("top"); } @@ -123,7 +117,7 @@ static struct shell_cmd test_shell_cmds[] = { }; int -main(int argc, char *argv[]) +main(void) { struct test_iodev iodev; struct termios termios; @@ -131,9 +125,6 @@ main(int argc, char *argv[]) struct shell shell; int ret; - (void)argc; - (void)argv; - test_iodev_init(&iodev, stdin, stdout); shell_cmd_set_init(&cmd_set); SHELL_REGISTER_CMDS(test_shell_cmds, &cmd_set); -- cgit v1.2.3