From: Kees van Reeuwijk Date: Thu, 28 Jan 2010 13:17:07 +0000 (+0000) Subject: Fixed a number of complaints about missing return statements. X-Git-Tag: v3.1.7~332 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/rndc.conf.html?a=commitdiff_plain;h=477b616fe864ff521451c213e452c564e8d5c1ee;p=minix.git Fixed a number of complaints about missing return statements. Some cases were fixed by declaring the function void, others were fixed by adding a return statement, thereby avoiding potentially incorrect behavior (usually in error handling). Some enum correctness in boot.c. --- diff --git a/boot/boot.c b/boot/boot.c index b33b63483..067dd6233 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -726,10 +726,10 @@ char resnames[][6] = { /* Using this for all null strings saves a lot of memory. */ #define null (resnames[0]) -int reserved(char *s) +enum resnames reserved(char *s) /* Recognize reserved strings. */ { - int r; + enum resnames r; for (r= R_BOOT; r <= R_UNSET; r++) { if (strcmp(s, resnames[r]) == 0) return r; @@ -1415,6 +1415,7 @@ int exec_bootstrap(void) return r; bootstrap(device, active); + return 0; } void boot_device(char *devname) @@ -1659,7 +1660,7 @@ void execute(void) { token *second, *third, *fourth, *sep; char *name; - int res; + enum resnames res; size_t n= 0; if (err) { diff --git a/boot/mkfile.c b/boot/mkfile.c index bee810f4b..60c06228f 100644 --- a/boot/mkfile.c +++ b/boot/mkfile.c @@ -21,7 +21,7 @@ int printf(const char *fmt, ...); #define SEEK_END 2 /* Kernel printf requires a putk() function. */ -int putk(int c) +void putk(int c) { char ch = c; diff --git a/drivers/dec21140A/dec21140A.c b/drivers/dec21140A/dec21140A.c index 06d635669..0308a183a 100644 --- a/drivers/dec21140A/dec21140A.c +++ b/drivers/dec21140A/dec21140A.c @@ -85,6 +85,7 @@ int sef_cb_init(int type, sef_init_info_t *info) notify(tasknr); else if(r != ESRCH) printf("%s unable to notify inet: %d\n", str_DevName, r); + return r; } /*===========================================================================* diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 331ae3b04..b784e59a1 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -579,7 +579,7 @@ PUBLIC int vm_contiguous(struct proc *targetproc, u32_t vir_buf, size_t bytes) /*===========================================================================* * vm_suspend * *===========================================================================*/ -PRIVATE int vm_suspend(struct proc *caller, struct proc *target, +PRIVATE void vm_suspend(struct proc *caller, struct proc *target, vir_bytes linaddr, vir_bytes len, int wrflag, int type) { /* This range is not OK for this process. Set parameters @@ -979,7 +979,7 @@ PUBLIC int data_copy_vmcheck( /*===========================================================================* * arch_pre_exec * *===========================================================================*/ -PUBLIC int arch_pre_exec(struct proc *pr, u32_t ip, u32_t sp) +PUBLIC void arch_pre_exec(struct proc *pr, u32_t ip, u32_t sp) { /* wipe extra LDT entries, set program counter, and stack pointer. */ memset(pr->p_seg.p_ldt + EXTRA_LDT_INDEX, 0, diff --git a/kernel/proto.h b/kernel/proto.h index c06c4a1cb..79cd21302 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -151,7 +151,7 @@ _PROTOTYPE( void arch_ack_profile_clock, (void) ); _PROTOTYPE( void do_ser_debug, (void) ); _PROTOTYPE( int arch_get_params, (char *parm, int max)); _PROTOTYPE( int arch_set_params, (char *parm, int max)); -_PROTOTYPE( int arch_pre_exec, (struct proc *pr, u32_t, u32_t)); +_PROTOTYPE( void arch_pre_exec, (struct proc *pr, u32_t, u32_t)); _PROTOTYPE( int arch_umap, (struct proc *pr, vir_bytes, vir_bytes, int, phys_bytes *)); _PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p)); diff --git a/lib/ansi/ext_comp.c b/lib/ansi/ext_comp.c index 41ee65dba..91ce7750a 100644 --- a/lib/ansi/ext_comp.c +++ b/lib/ansi/ext_comp.c @@ -17,9 +17,9 @@ #include static int b64_add(struct mantissa *e1, struct mantissa *e2); -static b64_sft(struct mantissa *e1, int n); +static void b64_sft(struct mantissa *e1, int n); -static +static void mul_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3) { /* Multiply the extended numbers e1 and e2, and put the @@ -93,7 +93,7 @@ mul_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3) } } -static +static void add_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3) { /* Add two extended numbers e1 and e2, and put the result @@ -182,7 +182,7 @@ cmp_ext(struct EXTEND *e1, struct EXTEND *e2) return 1; } -static +static void b64_sft(struct mantissa *e1, int n) { if (n > 0) { @@ -435,7 +435,7 @@ static struct EXTEND r_big_ten_powers[] = { /* representation of 10 ** -(28*i) * #define BTP (int)(sizeof(big_ten_powers)/sizeof(big_ten_powers[0])) #define MAX_EXP (TP * BTP - 1) -static +static void add_exponent(struct EXTEND *e, int exp) { int neg = exp < 0; @@ -455,7 +455,7 @@ add_exponent(struct EXTEND *e, int exp) } } -_str_ext_cvt(const char *s, char **ss, struct EXTEND *e) +void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e) { /* Like strtod, but for extended precision */ register int c; @@ -538,7 +538,8 @@ _str_ext_cvt(const char *s, char **ss, struct EXTEND *e) #include -static + +static void ten_mult(struct EXTEND *e) { struct EXTEND e1 = *e; @@ -696,7 +697,7 @@ _ext_str_cvt(struct EXTEND *e, int ndigit, int *decpt, int *sign, int ecvtflag) return buf; } -_dbl_ext_cvt(double value, struct EXTEND *e) +void _dbl_ext_cvt(double value, struct EXTEND *e) { /* Convert double to extended */ diff --git a/servers/rs/manager.c b/servers/rs/manager.c index 3d9fbd02f..6a318157f 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -26,7 +26,7 @@ FORWARD _PROTOTYPE( int copy_label, (endpoint_t src_e, struct rss_label *src_label, char *dst_label, size_t dst_len) ); FORWARD _PROTOTYPE( int start_service, (struct rproc *rp, int flags, endpoint_t *ep) ); -FORWARD _PROTOTYPE( int stop_service, (struct rproc *rp,int how) ); +FORWARD _PROTOTYPE( void stop_service, (struct rproc *rp,int how) ); FORWARD _PROTOTYPE( int fork_nb, (void) ); FORWARD _PROTOTYPE( int read_exec, (struct rproc *rp) ); FORWARD _PROTOTYPE( int share_exec, (struct rproc *rp_src, @@ -1329,9 +1329,7 @@ endpoint_t *endpoint; /*===========================================================================* * stop_service * *===========================================================================*/ -PRIVATE int stop_service(rp,how) -struct rproc *rp; -int how; +PRIVATE void stop_service(struct rproc *rp,int how) { /* Try to stop the system service. First send a SIGTERM signal to ask the * system service to terminate. If the service didn't install a signal diff --git a/servers/vm/map_mem.c b/servers/vm/map_mem.c index 508dbcb36..5f0f39ee8 100644 --- a/servers/vm/map_mem.c +++ b/servers/vm/map_mem.c @@ -134,7 +134,7 @@ PRIVATE void clean_phys_regions(struct vir_region *region, /*===========================================================================* * do_map_memory * *===========================================================================*/ -PRIVATE int do_map_memory(struct vmproc *vms, struct vmproc *vmd, +PRIVATE void do_map_memory(struct vmproc *vms, struct vmproc *vmd, struct vir_region *vrs, struct vir_region *vrd, vir_bytes offset_s, vir_bytes offset_d, vir_bytes length, int flag)