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 <value> statement, thereby avoiding potentially
incorrect behavior (usually in error handling).
Some enum correctness in boot.c.
This commit is contained in:
Kees van Reeuwijk 2010-01-28 13:17:07 +00:00
parent 564e2a4368
commit 477b616fe8
8 changed files with 21 additions and 20 deletions

View file

@ -726,10 +726,10 @@ char resnames[][6] = {
/* Using this for all null strings saves a lot of memory. */ /* Using this for all null strings saves a lot of memory. */
#define null (resnames[0]) #define null (resnames[0])
int reserved(char *s) enum resnames reserved(char *s)
/* Recognize reserved strings. */ /* Recognize reserved strings. */
{ {
int r; enum resnames r;
for (r= R_BOOT; r <= R_UNSET; r++) { for (r= R_BOOT; r <= R_UNSET; r++) {
if (strcmp(s, resnames[r]) == 0) return r; if (strcmp(s, resnames[r]) == 0) return r;
@ -1415,6 +1415,7 @@ int exec_bootstrap(void)
return r; return r;
bootstrap(device, active); bootstrap(device, active);
return 0;
} }
void boot_device(char *devname) void boot_device(char *devname)
@ -1659,7 +1660,7 @@ void execute(void)
{ {
token *second, *third, *fourth, *sep; token *second, *third, *fourth, *sep;
char *name; char *name;
int res; enum resnames res;
size_t n= 0; size_t n= 0;
if (err) { if (err) {

View file

@ -21,7 +21,7 @@ int printf(const char *fmt, ...);
#define SEEK_END 2 #define SEEK_END 2
/* Kernel printf requires a putk() function. */ /* Kernel printf requires a putk() function. */
int putk(int c) void putk(int c)
{ {
char ch = c; char ch = c;

View file

@ -85,6 +85,7 @@ int sef_cb_init(int type, sef_init_info_t *info)
notify(tasknr); notify(tasknr);
else if(r != ESRCH) else if(r != ESRCH)
printf("%s unable to notify inet: %d\n", str_DevName, r); printf("%s unable to notify inet: %d\n", str_DevName, r);
return r;
} }
/*===========================================================================* /*===========================================================================*

View file

@ -579,7 +579,7 @@ PUBLIC int vm_contiguous(struct proc *targetproc, u32_t vir_buf, size_t bytes)
/*===========================================================================* /*===========================================================================*
* vm_suspend * * 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) vir_bytes linaddr, vir_bytes len, int wrflag, int type)
{ {
/* This range is not OK for this process. Set parameters /* This range is not OK for this process. Set parameters
@ -979,7 +979,7 @@ PUBLIC int data_copy_vmcheck(
/*===========================================================================* /*===========================================================================*
* arch_pre_exec * * 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. */ /* wipe extra LDT entries, set program counter, and stack pointer. */
memset(pr->p_seg.p_ldt + EXTRA_LDT_INDEX, 0, memset(pr->p_seg.p_ldt + EXTRA_LDT_INDEX, 0,

View file

@ -151,7 +151,7 @@ _PROTOTYPE( void arch_ack_profile_clock, (void) );
_PROTOTYPE( void do_ser_debug, (void) ); _PROTOTYPE( void do_ser_debug, (void) );
_PROTOTYPE( int arch_get_params, (char *parm, int max)); _PROTOTYPE( int arch_get_params, (char *parm, int max));
_PROTOTYPE( int arch_set_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, _PROTOTYPE( int arch_umap, (struct proc *pr, vir_bytes, vir_bytes,
int, phys_bytes *)); int, phys_bytes *));
_PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p)); _PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p));

View file

@ -17,9 +17,9 @@
#include <ctype.h> #include <ctype.h>
static int b64_add(struct mantissa *e1, struct mantissa *e2); 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) mul_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3)
{ {
/* Multiply the extended numbers e1 and e2, and put the /* 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_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3)
{ {
/* Add two extended numbers e1 and e2, and put the result /* 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; return 1;
} }
static static void
b64_sft(struct mantissa *e1, int n) b64_sft(struct mantissa *e1, int n)
{ {
if (n > 0) { 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 BTP (int)(sizeof(big_ten_powers)/sizeof(big_ten_powers[0]))
#define MAX_EXP (TP * BTP - 1) #define MAX_EXP (TP * BTP - 1)
static static void
add_exponent(struct EXTEND *e, int exp) add_exponent(struct EXTEND *e, int exp)
{ {
int neg = exp < 0; 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 */ /* Like strtod, but for extended precision */
register int c; register int c;
@ -538,7 +538,8 @@ _str_ext_cvt(const char *s, char **ss, struct EXTEND *e)
#include <math.h> #include <math.h>
static
static void
ten_mult(struct EXTEND *e) ten_mult(struct EXTEND *e)
{ {
struct EXTEND e1 = *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; return buf;
} }
_dbl_ext_cvt(double value, struct EXTEND *e) void _dbl_ext_cvt(double value, struct EXTEND *e)
{ {
/* Convert double to extended /* Convert double to extended
*/ */

View file

@ -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) ); struct rss_label *src_label, char *dst_label, size_t dst_len) );
FORWARD _PROTOTYPE( int start_service, (struct rproc *rp, int flags, FORWARD _PROTOTYPE( int start_service, (struct rproc *rp, int flags,
endpoint_t *ep) ); 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 fork_nb, (void) );
FORWARD _PROTOTYPE( int read_exec, (struct rproc *rp) ); FORWARD _PROTOTYPE( int read_exec, (struct rproc *rp) );
FORWARD _PROTOTYPE( int share_exec, (struct rproc *rp_src, FORWARD _PROTOTYPE( int share_exec, (struct rproc *rp_src,
@ -1329,9 +1329,7 @@ endpoint_t *endpoint;
/*===========================================================================* /*===========================================================================*
* stop_service * * stop_service *
*===========================================================================*/ *===========================================================================*/
PRIVATE int stop_service(rp,how) PRIVATE void stop_service(struct rproc *rp,int how)
struct rproc *rp;
int how;
{ {
/* Try to stop the system service. First send a SIGTERM signal to ask the /* 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 * system service to terminate. If the service didn't install a signal

View file

@ -134,7 +134,7 @@ PRIVATE void clean_phys_regions(struct vir_region *region,
/*===========================================================================* /*===========================================================================*
* do_map_memory * * 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, struct vir_region *vrs, struct vir_region *vrd,
vir_bytes offset_s, vir_bytes offset_d, vir_bytes offset_s, vir_bytes offset_d,
vir_bytes length, int flag) vir_bytes length, int flag)