From 448889a4f0c32ba8ea61f870d4edcb0e0d58af85 Mon Sep 17 00:00:00 2001 From: Flavio Cruz Date: Tue, 20 Dec 2022 20:01:02 -0500 Subject: Use -Wstrict-prototypes and fix warnings Most of the changes include defining and using proper function type declarations (with argument types declared) and avoiding using the K&R style of function declarations. Message-Id: --- kern/exception.c | 5 ++--- kern/ipc_mig.c | 5 +---- kern/syscall_sw.h | 8 +++++--- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'kern') diff --git a/kern/exception.c b/kern/exception.c index 2ff122f2..0d8191a7 100644 --- a/kern/exception.c +++ b/kern/exception.c @@ -449,9 +449,8 @@ exception_raise( receiver = ipc_thread_queue_first(&dest_mqueue->imq_threads); if ((receiver == ITH_NULL) || - !((receiver->swap_func == (void (*)()) mach_msg_continue) || - ((receiver->swap_func == - (void (*)()) mach_msg_receive_continue) && + !((receiver->swap_func == mach_msg_continue) || + ((receiver->swap_func == mach_msg_receive_continue) && (sizeof(struct mach_exception) <= receiver->ith_msize) && ((receiver->ith_option & MACH_RCV_NOTIFY) == 0))) || !thread_handoff(self, exception_raise_continue, receiver)) { diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c index 7ed12faa..f353009e 100644 --- a/kern/ipc_mig.c +++ b/kern/ipc_mig.c @@ -285,10 +285,7 @@ mig_put_reply_port( * len - Length of destination buffer. */ vm_size_t -mig_strncpy(dest, src, len) - char *dest; - const char *src; - int len; +mig_strncpy(char *dest, const char *src, int len) { char *dest_ = dest; int i; diff --git a/kern/syscall_sw.h b/kern/syscall_sw.h index 80b1810b..34eaf90b 100644 --- a/kern/syscall_sw.h +++ b/kern/syscall_sw.h @@ -35,9 +35,11 @@ * Note: this is indexed manually by locore.S! */ +typedef void (*generic_trap_function)(void); + typedef struct { int mach_trap_arg_count; - int (*mach_trap_function)(); + generic_trap_function mach_trap_function; boolean_t mach_trap_stack; const char *mach_trap_name; } mach_trap_t; @@ -46,8 +48,8 @@ extern mach_trap_t mach_trap_table[]; extern int mach_trap_count; #define MACH_TRAP(name, arg_count) \ - { (arg_count), (int (*)()) (name), FALSE, #name } + { (arg_count), (generic_trap_function) (name), FALSE, #name } #define MACH_TRAP_STACK(name, arg_count) \ - { (arg_count), (int (*)()) (name), TRUE, #name } + { (arg_count), (generic_trap_function) (name), TRUE, #name } #endif /* _KERN_SYSCALL_SW_H_ */ -- cgit v1.2.3