aboutsummaryrefslogtreecommitdiff
path: root/ddb/db_command.c
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-01-04 00:30:28 -0500
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-01-05 01:01:45 +0100
commitc8cd13d8e9853752de5756ab42a98e2d0baff0a9 (patch)
tree3da4d2d12fdb903b1a85e93cf9514e5d93f7ae67 /ddb/db_command.c
parentd7348c94453d2662affecbb7605047044898ed19 (diff)
downloadgnumach-c8cd13d8e9853752de5756ab42a98e2d0baff0a9.tar.gz
gnumach-c8cd13d8e9853752de5756ab42a98e2d0baff0a9.tar.bz2
gnumach-c8cd13d8e9853752de5756ab42a98e2d0baff0a9.zip
Fix ddb warnings introduced with -Wstrict-prototypes
Changed some ddb command functions to have the expected signature but not all of them due to the being difficult to inter-dependency between header files (for those just used cast). Message-Id: <Y7UO9HTfpZ8U0Nfy@mars>
Diffstat (limited to 'ddb/db_command.c')
-rw-r--r--ddb/db_command.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/ddb/db_command.c b/ddb/db_command.c
index c9e4f6ae..d21386e6 100644
--- a/ddb/db_command.c
+++ b/ddb/db_command.c
@@ -156,10 +156,10 @@ db_cmd_list(const struct db_command *table)
static void
db_command(
- struct db_command **last_cmdp, /* IN_OUT */
+ const struct db_command **last_cmdp, /* IN_OUT */
struct db_command *cmd_table)
{
- struct db_command *cmd;
+ const struct db_command *cmd = NULL;
int t;
char modif[TOK_STRING_SIZE];
db_expr_t addr, count;
@@ -266,7 +266,7 @@ db_command(
}
}
*last_cmdp = cmd;
- if (cmd != 0) {
+ if (cmd != NULL) {
/*
* Execute the command.
*/
@@ -296,7 +296,7 @@ db_command(
static void
db_command_list(
- struct db_command **last_cmdp, /* IN_OUT */
+ const struct db_command **last_cmdp, /* IN_OUT */
struct db_command *cmd_table)
{
do {
@@ -308,29 +308,29 @@ db_command_list(
struct db_command db_show_all_cmds[] = {
{ "tasks", db_show_all_tasks, 0, 0 },
{ "threads", db_show_all_threads, 0, 0 },
- { "slocks", db_show_all_slocks, 0, 0 },
+ { "slocks", (db_command_fun_t)db_show_all_slocks, 0, 0 },
{ (char *)0 }
};
struct db_command db_show_cmds[] = {
{ "all", 0, 0, db_show_all_cmds },
- { "registers", db_show_regs, 0, 0 },
+ { "registers", (db_command_fun_t)db_show_regs, 0, 0 },
{ "breaks", db_listbreak_cmd, 0, 0 },
{ "watches", db_listwatch_cmd, 0, 0 },
{ "thread", db_show_one_thread, 0, 0 },
{ "task", db_show_one_task, 0, 0 },
{ "macro", db_show_macro, CS_OWN, 0 },
{ "map", vm_map_print, 0, 0 },
- { "object", vm_object_print, 0, 0 },
- { "page", vm_page_print, 0, 0 },
- { "copy", vm_map_copy_print, 0, 0 },
- { "port", ipc_port_print, 0, 0 },
- { "pset", ipc_pset_print, 0, 0 },
- { "kmsg", ipc_kmsg_print, 0, 0 },
- { "msg", ipc_msg_print, 0, 0 },
+ { "object", (db_command_fun_t)vm_object_print, 0, 0 },
+ { "page", (db_command_fun_t)vm_page_print, 0, 0 },
+ { "copy", (db_command_fun_t)vm_map_copy_print, 0, 0 },
+ { "port", (db_command_fun_t)ipc_port_print, 0, 0 },
+ { "pset", (db_command_fun_t)ipc_pset_print, 0, 0 },
+ { "kmsg", (db_command_fun_t)ipc_kmsg_print, 0, 0 },
+ { "msg", (db_command_fun_t)ipc_msg_print, 0, 0 },
{ "ipc_port", db_show_port_id, 0, 0 },
- { "slabinfo", db_show_slab_info, 0, 0 },
- { "vmstat", db_show_vmstat, 0, 0 },
+ { "slabinfo", (db_command_fun_t)db_show_slab_info, 0, 0 },
+ { "vmstat", (db_command_fun_t)db_show_vmstat, 0, 0 },
{ (char *)0, }
};
@@ -356,13 +356,13 @@ struct db_command db_command_table[] = {
/* this must be the first entry, if it exists */
{ "machine", 0, 0, 0},
#endif
- { "print", db_print_cmd, CS_OWN, 0 },
+ { "print", (db_command_fun_t)db_print_cmd, CS_OWN, 0 },
{ "examine", db_examine_cmd, CS_MORE|CS_SET_DOT, 0 },
{ "x", db_examine_cmd, CS_MORE|CS_SET_DOT, 0 },
{ "xf", db_examine_forward, CS_SET_DOT, 0 },
{ "xb", db_examine_backward, CS_SET_DOT, 0 },
{ "search", db_search_cmd, CS_OWN|CS_SET_DOT, 0 },
- { "set", db_set_cmd, CS_OWN, 0 },
+ { "set", (db_command_fun_t)db_set_cmd, CS_OWN, 0 },
{ "write", db_write_cmd, CS_MORE|CS_SET_DOT, 0 },
{ "w", db_write_cmd, CS_MORE|CS_SET_DOT, 0 },
{ "delete", db_delete_cmd, CS_OWN, 0 },
@@ -379,14 +379,14 @@ struct db_command db_command_table[] = {
{ "match", db_trace_until_matching_cmd,0, 0 },
{ "trace", db_stack_trace_cmd, 0, 0 },
{ "cond", db_cond_cmd, CS_OWN, 0 },
- { "call", db_fncall, CS_OWN, 0 },
+ { "call", (db_command_fun_t)db_fncall, CS_OWN, 0 },
{ "macro", db_def_macro_cmd, CS_OWN, 0 },
{ "dmacro", db_del_macro_cmd, CS_OWN, 0 },
{ "show", 0, 0, db_show_cmds },
{ "debug", 0, 0, db_debug_cmds },
- { "reset", db_reset_cpu, 0, 0 },
- { "reboot", db_reset_cpu, 0, 0 },
- { "halt", db_halt_cpu, 0, 0 },
+ { "reset", (db_command_fun_t)db_reset_cpu, 0, 0 },
+ { "reboot", (db_command_fun_t)db_reset_cpu, 0, 0 },
+ { "halt", (db_command_fun_t)db_halt_cpu, 0, 0 },
{ (char *)0, }
};
@@ -403,7 +403,7 @@ void db_machine_commands_install(struct db_command *ptr)
#endif /* DB_MACHINE_COMMANDS */
-struct db_command *db_last_command = 0;
+const struct db_command *db_last_command = 0;
void
db_help_cmd(void)
@@ -500,7 +500,11 @@ db_fncall(void)
db_expr_t args[MAXARGS];
int nargs = 0;
db_expr_t retval;
- db_expr_t (*func)();
+ typedef db_expr_t(*function_t)(db_expr_t, db_expr_t, db_expr_t,
+ db_expr_t, db_expr_t, db_expr_t,
+ db_expr_t, db_expr_t, db_expr_t,
+ db_expr_t);
+ function_t func;
int t;
if (!db_expression(&fn_addr)) {
@@ -508,7 +512,7 @@ db_fncall(void)
db_flush_lex();
return;
}
- func = (db_expr_t (*) ()) fn_addr;
+ func = (function_t) fn_addr;
t = db_read_token();
if (t == tLPAREN) {