From f6f814cb028f3dfd1468f50b7a762223d8f385b6 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 6 Jul 2010 11:59:19 +0000 Subject: [PATCH] include, kernel: minor fixes to make compiling and linking work with clang. (fixing warnings) --- include/minix/sysutil.h | 2 +- include/time.h | 4 +++- kernel/Makefile | 2 +- kernel/arch/i386/apic.c | 4 ++-- kernel/arch/i386/arch_system.c | 4 ++-- kernel/arch/i386/arch_watchdog.c | 2 +- kernel/arch/i386/proto.h | 4 ++-- kernel/proto.h | 6 +++--- kernel/system.c | 6 +++--- kernel/system/do_fork.c | 2 +- kernel/system/do_getksig.c | 2 +- kernel/system/do_privctl.c | 2 +- 12 files changed, 21 insertions(+), 19 deletions(-) diff --git a/include/minix/sysutil.h b/include/minix/sysutil.h index e596e9635..477ce5db6 100644 --- a/include/minix/sysutil.h +++ b/include/minix/sysutil.h @@ -44,7 +44,7 @@ _PROTOTYPE( int fkey_ctl, (int req, int *fkeys, int *sfkeys) ); _PROTOTYPE( int printf, (const char *fmt, ...)); _PROTOTYPE( void kputc, (int c)); -_PROTOTYPE( void panic, (const char *fmt, ...)); +_PROTOTYPE( __dead void panic, (const char *fmt, ...)); _PROTOTYPE( int getuptime, (clock_t *ticks)); _PROTOTYPE( int getuptime2, (clock_t *ticks, time_t *boottime)); _PROTOTYPE( int tickdelay, (clock_t ticks)); diff --git a/include/time.h b/include/time.h index 7dc7de459..bf9ce68a3 100644 --- a/include/time.h +++ b/include/time.h @@ -66,8 +66,10 @@ _PROTOTYPE( struct tm *localtime_r, (const time_t *const timep, struct tm *tmp) ); _PROTOTYPE( size_t strftime, (char *_s, size_t _max, const char *_fmt, const struct tm *_timep) ); -_PROTOTYPE(char *strptime, (const char *buf, const char *format, +_PROTOTYPE( char *strptime, (const char *buf, const char *format, struct tm *timeptr) ); +_PROTOTYPE( time_t timegm, (struct tm * const tmp) ); + #ifdef _POSIX_SOURCE _PROTOTYPE( void tzset, (void) ); diff --git a/kernel/Makefile b/kernel/Makefile index 61a87376c..db21920cd 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -17,7 +17,7 @@ LDFLAGS+= -.o .elif ${COMPILER_TYPE} == "gnu" CPPFLAGS+= -fno-builtin -ffreestanding -fno-stack-protector LDFLAGS+= -T arch/${ARCH}/kernel.lds -LDFLAGS+= -nostdlib +LDFLAGS+= -nostdlib -L/usr/gnu/lib DPADD+= ${LIBC} LDADD+= -lc .endif diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 44b58a061..4b0804cfe 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -298,7 +298,7 @@ PRIVATE int lapic_enable(void) val |= APIC_ENABLE | APIC_SPURIOUS_INT_VECTOR; val &= ~APIC_FOCUS_DISABLED; lapic_write(LAPIC_SIVR, val); - lapic_read(LAPIC_SIVR); + (void) lapic_read(LAPIC_SIVR); *((u32_t *)lapic_eoi_addr) = 0; @@ -337,7 +337,7 @@ PRIVATE int lapic_enable(void) /* accept all interrupts */ lapic_write (LAPIC_TPR, val & ~0xFF); - lapic_read (LAPIC_SIVR); + (void) lapic_read (LAPIC_SIVR); *((u32_t *)lapic_eoi_addr) = 0; apic_calibrate_clocks(); diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index ee039e3a9..bfbe5a2ab 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -39,14 +39,14 @@ PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */ FORWARD _PROTOTYPE( void ser_debug, (int c)); -PUBLIC void arch_monitor(void) +PUBLIC __dead void arch_monitor(void) { monitor(); } PUBLIC int cpu_has_tsc; -PUBLIC void arch_shutdown(const int how) +PUBLIC __dead void arch_shutdown(const int how) { vm_stop(); diff --git a/kernel/arch/i386/arch_watchdog.c b/kernel/arch/i386/arch_watchdog.c index 91729e8a0..08557bbd2 100644 --- a/kernel/arch/i386/arch_watchdog.c +++ b/kernel/arch/i386/arch_watchdog.c @@ -77,7 +77,7 @@ int arch_watchdog_init(void) /* Setup PC tas NMI for watchdog, is is masked for now */ lapic_write(LAPIC_LVTPCR, APIC_ICR_INT_MASK | APIC_ICR_DM_NMI); - lapic_read(LAPIC_LVTPCR); + (void) lapic_read(LAPIC_LVTPCR); /* double check if LAPIC is enabled */ if (lapic_addr && watchdog_enabled && watchdog->init) { diff --git a/kernel/arch/i386/proto.h b/kernel/arch/i386/proto.h index cdc40ab82..5e08220b0 100644 --- a/kernel/arch/i386/proto.h +++ b/kernel/arch/i386/proto.h @@ -66,8 +66,8 @@ struct exception_frame { _PROTOTYPE( void exception, (struct exception_frame * frame)); /* klib386.s */ -_PROTOTYPE( void monitor, (void) ); -_PROTOTYPE( void reset, (void) ); +_PROTOTYPE( __dead void monitor, (void) ); +_PROTOTYPE( __dead void reset, (void) ); _PROTOTYPE( void int86, (void) ); _PROTOTYPE( reg_t read_cr0, (void) ); _PROTOTYPE( reg_t read_cr2, (void) ); diff --git a/kernel/proto.h b/kernel/proto.h index cdb462f26..910f9a5d8 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -36,7 +36,7 @@ _PROTOTYPE( void fpu_sigcontext, (struct proc *, struct sigframe *fr, struct sig /* main.c */ _PROTOTYPE( void main, (void) ); _PROTOTYPE( void prepare_shutdown, (int how) ); -_PROTOTYPE( void minix_shutdown, (struct timer *tp) ); +_PROTOTYPE( __dead void minix_shutdown, (struct timer *tp) ); /* proc.c */ @@ -166,8 +166,8 @@ _PROTOTYPE( int intr_init, (int, int) ); _PROTOTYPE( void halt_cpu, (void) ); _PROTOTYPE( void arch_init, (void) ); _PROTOTYPE( void ser_putc, (char) ); -_PROTOTYPE( void arch_shutdown, (int) ); -_PROTOTYPE( void arch_monitor, (void) ); +_PROTOTYPE( __dead void arch_shutdown, (int) ); +_PROTOTYPE( __dead void arch_monitor, (void) ); _PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) ); _PROTOTYPE( void restore_user_context, (struct proc * p) ); _PROTOTYPE( void read_tsc, (unsigned long *high, unsigned long *low) ); diff --git a/kernel/system.c b/kernel/system.c index e3a1b769a..09c3b9bc4 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -348,7 +348,7 @@ PUBLIC void send_sig(endpoint_t proc_nr, int sig_nr) panic("send_sig to empty process: %d", proc_nr); rp = proc_addr(proc_nr); - sigaddset(&priv(rp)->s_sig_pending, sig_nr); + (void) sigaddset(&priv(rp)->s_sig_pending, sig_nr); mini_notify(proc_addr(SYSTEM), rp->p_endpoint); } @@ -386,14 +386,14 @@ int sig_nr; /* signal to be sent */ panic("cause_sig: signal manager gets lethal signal %d for itself", sig_nr); } - sigaddset(&priv(rp)->s_sig_pending, sig_nr); + (void) sigaddset(&priv(rp)->s_sig_pending, sig_nr); send_sig(rp->p_endpoint, SIGKSIGSM); return; } /* Check if the signal is already pending. Process it otherwise. */ if (! sigismember(&rp->p_pending, sig_nr)) { - sigaddset(&rp->p_pending, sig_nr); + (void) sigaddset(&rp->p_pending, sig_nr); if (! (RTS_ISSET(rp, RTS_SIGNALED))) { /* other pending */ RTS_SET(rp, RTS_SIGNALED | RTS_SIG_PENDING); send_sig(sig_mgr, SIGKSIG); diff --git a/kernel/system/do_fork.c b/kernel/system/do_fork.c index 81d079c98..49815e5ac 100644 --- a/kernel/system/do_fork.c +++ b/kernel/system/do_fork.c @@ -117,7 +117,7 @@ PUBLIC int do_fork(struct proc * caller, message * m_ptr) * Only one in group should have RTS_SIGNALED, child doesn't inherit tracing. */ RTS_UNSET(rpc, (RTS_SIGNALED | RTS_SIG_PENDING | RTS_P_STOP)); - sigemptyset(&rpc->p_pending); + (void) sigemptyset(&rpc->p_pending); rpc->p_seg.p_cr3 = 0; rpc->p_seg.p_cr3_v = NULL; diff --git a/kernel/system/do_getksig.c b/kernel/system/do_getksig.c index c93cf7ab5..561707284 100644 --- a/kernel/system/do_getksig.c +++ b/kernel/system/do_getksig.c @@ -30,7 +30,7 @@ PUBLIC int do_getksig(struct proc * caller, message * m_ptr) /* store signaled process' endpoint */ m_ptr->SIG_ENDPT = rp->p_endpoint; m_ptr->SIG_MAP = rp->p_pending; /* pending signals map */ - sigemptyset(&rp->p_pending); /* clear map in the kernel */ + (void) sigemptyset(&rp->p_pending); /* clear map in the kernel */ RTS_UNSET(rp, RTS_SIGNALED); /* blocked by SIG_PENDING */ return(OK); } diff --git a/kernel/system/do_privctl.c b/kernel/system/do_privctl.c index aebdfc03b..eaefe76bd 100644 --- a/kernel/system/do_privctl.c +++ b/kernel/system/do_privctl.c @@ -98,7 +98,7 @@ PUBLIC int do_privctl(struct proc * caller, message * m_ptr) for (i=0; i< NR_SYS_CHUNKS; i++) /* remove pending: */ priv(rp)->s_notify_pending.chunk[i] = 0; /* - notifications */ priv(rp)->s_int_pending = 0; /* - interrupts */ - sigemptyset(&priv(rp)->s_sig_pending); /* - signals */ + (void) sigemptyset(&priv(rp)->s_sig_pending); /* - signals */ reset_timer(&priv(rp)->s_alarm_timer); /* - alarm */ priv(rp)->s_asyntab= -1; /* - asynsends */ priv(rp)->s_asynsize= 0; -- 2.44.0