From: Jorrit Herder Date: Tue, 21 Jun 2005 10:47:46 +0000 (+0000) Subject: Fixed various GCC compiler warnings for the kernel. X-Git-Tag: v3.1.0~715 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/cppcheck-error.log?a=commitdiff_plain;h=355a10864b45eade451c8f1ec4f81000273451fa;p=minix.git Fixed various GCC compiler warnings for the kernel. Only main() now gives a warning about the return type (GCC wants an int). --- diff --git a/kernel/clock.c b/kernel/clock.c index 7329f3ba3..e722cb118 100755 --- a/kernel/clock.c +++ b/kernel/clock.c @@ -150,10 +150,6 @@ message *m_ptr; /* pointer to request message */ /* Despite its name, this routine is not called on every clock tick. It * is called on those clock ticks when a lot of work needs to be done. */ - register struct proc *rp; - register int proc_nr; - timer_t *tp; - struct proc *p; /* Check if a clock timer expired and run its watchdog function. */ if (next_timeout <= realtime) { @@ -226,7 +222,6 @@ irq_hook_t *hook; * faster on a 5MHz 8088, and make task debugging much easier since there are * no task switches on an inactive system. */ - register struct proc *rp; register unsigned ticks; message m; #if ! NEW_TIME_COUNT diff --git a/kernel/exception.c b/kernel/exception.c index d3c7810c5..3cac6ab24 100755 --- a/kernel/exception.c +++ b/kernel/exception.c @@ -22,23 +22,23 @@ unsigned vec_nr; int minprocessor; }; static struct ex_s ex_data[] = { - "Divide error", SIGFPE, 86, - "Debug exception", SIGTRAP, 86, - "Nonmaskable interrupt", SIGBUS, 86, - "Breakpoint", SIGEMT, 86, - "Overflow", SIGFPE, 86, - "Bounds check", SIGFPE, 186, - "Invalid opcode", SIGILL, 186, - "Coprocessor not available", SIGFPE, 186, - "Double fault", SIGBUS, 286, - "Copressor segment overrun", SIGSEGV, 286, - "Invalid TSS", SIGSEGV, 286, - "Segment not present", SIGSEGV, 286, - "Stack exception", SIGSEGV, 286, /* STACK_FAULT already used */ - "General protection", SIGSEGV, 286, - "Page fault", SIGSEGV, 386, /* not close */ - NIL_PTR, SIGILL, 0, /* probably software trap */ - "Coprocessor error", SIGFPE, 386, + { "Divide error", SIGFPE, 86 }, + { "Debug exception", SIGTRAP, 86 }, + { "Nonmaskable interrupt", SIGBUS, 86 }, + { "Breakpoint", SIGEMT, 86 }, + { "Overflow", SIGFPE, 86 }, + { "Bounds check", SIGFPE, 186 }, + { "Invalid opcode", SIGILL, 186 }, + { "Coprocessor not available", SIGFPE, 186 }, + { "Double fault", SIGBUS, 286 }, + { "Copressor segment overrun", SIGSEGV, 286 }, + { "Invalid TSS", SIGSEGV, 286 }, + { "Segment not present", SIGSEGV, 286 }, + { "Stack exception", SIGSEGV, 286 }, /* STACK_FAULT already used */ + { "General protection", SIGSEGV, 286 }, + { "Page fault", SIGSEGV, 386 }, /* not close */ + { NIL_PTR, SIGILL, 0 }, /* probably software trap */ + { "Coprocessor error", SIGFPE, 386 }, }; register struct ex_s *ep; struct proc *saved_proc; diff --git a/kernel/proc.c b/kernel/proc.c index 6e60af384..7bd2c9e64 100755 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -436,7 +436,6 @@ register struct proc *rp; /* this process is now runnable */ { /* Add 'rp' to one of the queues of runnable processes. */ register int q = rp->p_priority; /* scheduling queue to use */ - register struct proc **xpp; /* iterate over queue */ #if ENABLE_K_DEBUGGING if(rp->p_ready) { diff --git a/kernel/protect.c b/kernel/protect.c index 5be6f1615..0d331845f 100755 --- a/kernel/protect.c +++ b/kernel/protect.c @@ -93,23 +93,23 @@ PUBLIC void prot_init() unsigned char privilege; } gate_table[] = { - divide_error, DIVIDE_VECTOR, INTR_PRIVILEGE, - single_step_exception, DEBUG_VECTOR, INTR_PRIVILEGE, - nmi, NMI_VECTOR, INTR_PRIVILEGE, - breakpoint_exception, BREAKPOINT_VECTOR, USER_PRIVILEGE, - overflow, OVERFLOW_VECTOR, USER_PRIVILEGE, - bounds_check, BOUNDS_VECTOR, INTR_PRIVILEGE, - inval_opcode, INVAL_OP_VECTOR, INTR_PRIVILEGE, - copr_not_available, COPROC_NOT_VECTOR, INTR_PRIVILEGE, - double_fault, DOUBLE_FAULT_VECTOR, INTR_PRIVILEGE, - copr_seg_overrun, COPROC_SEG_VECTOR, INTR_PRIVILEGE, - inval_tss, INVAL_TSS_VECTOR, INTR_PRIVILEGE, - segment_not_present, SEG_NOT_VECTOR, INTR_PRIVILEGE, - stack_exception, STACK_FAULT_VECTOR, INTR_PRIVILEGE, - general_protection, PROTECTION_VECTOR, INTR_PRIVILEGE, + { divide_error, DIVIDE_VECTOR, INTR_PRIVILEGE }, + { single_step_exception, DEBUG_VECTOR, INTR_PRIVILEGE }, + { nmi, NMI_VECTOR, INTR_PRIVILEGE }, + { breakpoint_exception, BREAKPOINT_VECTOR, USER_PRIVILEGE }, + { overflow, OVERFLOW_VECTOR, USER_PRIVILEGE }, + { bounds_check, BOUNDS_VECTOR, INTR_PRIVILEGE }, + { inval_opcode, INVAL_OP_VECTOR, INTR_PRIVILEGE }, + { copr_not_available, COPROC_NOT_VECTOR, INTR_PRIVILEGE }, + { double_fault, DOUBLE_FAULT_VECTOR, INTR_PRIVILEGE }, + { copr_seg_overrun, COPROC_SEG_VECTOR, INTR_PRIVILEGE }, + { inval_tss, INVAL_TSS_VECTOR, INTR_PRIVILEGE }, + { segment_not_present, SEG_NOT_VECTOR, INTR_PRIVILEGE }, + { stack_exception, STACK_FAULT_VECTOR, INTR_PRIVILEGE }, + { general_protection, PROTECTION_VECTOR, INTR_PRIVILEGE }, #if _WORD_SIZE == 4 - page_fault, PAGE_FAULT_VECTOR, INTR_PRIVILEGE, - copr_error, COPROC_ERR_VECTOR, INTR_PRIVILEGE, + { page_fault, PAGE_FAULT_VECTOR, INTR_PRIVILEGE }, + { copr_error, COPROC_ERR_VECTOR, INTR_PRIVILEGE }, #endif { hwint00, VECTOR( 0), INTR_PRIVILEGE }, { hwint01, VECTOR( 1), INTR_PRIVILEGE }, diff --git a/kernel/start.c b/kernel/start.c index 2f87cffc3..21ccbfccf 100755 --- a/kernel/start.c +++ b/kernel/start.c @@ -27,7 +27,6 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */ */ char params[128*sizeof(char *)]; /* boot monitor parameters */ register char *value; /* value in key=value pair */ - unsigned mon_start; extern int etext, end; /* Decide if mode is protected; 386 or higher implies protected mode. diff --git a/kernel/system.c b/kernel/system.c index 1a9f7db30..1f1e1e902 100755 --- a/kernel/system.c +++ b/kernel/system.c @@ -320,7 +320,7 @@ int sig_nr; /* signal to be sent, 1 to _NSIG */ * the process when PM is informed, because PM can block waiting for FS to * do a core dump. */ - register struct proc *rp, *mmp; + register struct proc *rp; message m; rp = proc_addr(proc_nr); @@ -353,10 +353,9 @@ vir_bytes bytes; /* # of bytes to be copied */ * calling function will think an error occurred. This is not a problem, * since no one uses the first BIOS interrupt vector. */ - phys_bytes phys_addr; /* Check all acceptable ranges. */ -#if 0 +#if DEAD_CODE if (vir_addr >= BIOS_MEM_BEGIN && vir_addr + bytes <= BIOS_MEM_END) return (phys_bytes) vir_addr; else if (vir_addr >= UPPER_MEM_BEGIN && vir_addr + bytes <= UPPER_MEM_END) diff --git a/kernel/system/irqctl.c b/kernel/system/irqctl.c index be743219f..8cb0a1a71 100644 --- a/kernel/system/irqctl.c +++ b/kernel/system/irqctl.c @@ -23,7 +23,6 @@ register message *m_ptr; /* pointer to request message */ /* Dismember the request message. */ int irq_vec; int irq_hook_id; - int proc_nr; int r = OK; irq_hook_t *hook_ptr; diff --git a/kernel/system/proctl.c b/kernel/system/proctl.c index a608a8987..0bd3fd7b9 100644 --- a/kernel/system/proctl.c +++ b/kernel/system/proctl.c @@ -188,8 +188,7 @@ message *m_ptr; /* pointer to request message */ { /* Handle sys_exit. A user process has exited (the PM sent the request). */ - register struct proc *rp, *rc; - struct proc *np, *xp; + register struct proc *rc; int exit_proc_nr; /* Get a pointer to the process that exited. */ diff --git a/kernel/system/sysctl.c b/kernel/system/sysctl.c index ba014b5b0..37da42175 100644 --- a/kernel/system/sysctl.c +++ b/kernel/system/sysctl.c @@ -25,7 +25,6 @@ message *m_ptr; /* pointer to request message */ /* Handle sys_exit. A server or driver wants to exit. This may happen * on a panic, but also is done when MINIX is shutdown. */ - register struct proc *rp; int proc_nr = m_ptr->m_source; /* can only exit own process */ if (m_ptr->EXIT_STATUS != 0) {