From 6356a9c88e04455186a9b6d683ace14dadb891b7 Mon Sep 17 00:00:00 2001 From: mtm Date: Fri, 23 May 2003 09:48:20 +0000 Subject: Make WARNS2 clean. The fixes mostly included: o removed unused variables o explicit inclusion of header files o prototypes for externally defined functions Approved by: re/blanket libthr --- lib/libthr/Makefile | 2 ++ lib/libthr/arch/i386/i386/_setcurthread.c | 5 +++++ lib/libthr/thread/thr_autoinit.c | 4 ++++ lib/libthr/thread/thr_cancel.c | 1 + lib/libthr/thread/thr_create.c | 1 - lib/libthr/thread/thr_detach.c | 1 + lib/libthr/thread/thr_exit.c | 3 +++ lib/libthr/thread/thr_init.c | 3 +-- lib/libthr/thread/thr_kern.c | 2 +- lib/libthr/thread/thr_mutex.c | 6 ++++-- lib/libthr/thread/thr_printf.c | 1 + lib/libthr/thread/thr_private.h | 2 +- lib/libthr/thread/thr_resume_np.c | 1 + lib/libthr/thread/thr_setschedparam.c | 5 ++++- lib/libthr/thread/thr_sig.c | 4 ++-- lib/libthr/thread/thr_syscalls.c | 10 ++++++++++ 16 files changed, 41 insertions(+), 10 deletions(-) diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 6bfa593..de4307e 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -20,6 +20,8 @@ CFLAGS+=-D_PTHREADS_INVARIANTS AINC= -I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/thread PRECIOUSLIB= yes +WARNS?= 2 + .include "${.CURDIR}/thread/Makefile.inc" .include "${.CURDIR}/sys/Makefile.inc" .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc" diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c index b561f3f..69a5e8f 100644 --- a/lib/libthr/arch/i386/i386/_setcurthread.c +++ b/lib/libthr/arch/i386/i386/_setcurthread.c @@ -31,6 +31,8 @@ #include #include +#include +#include #include #include @@ -48,6 +50,9 @@ static spinlock_t ldt_lock = _SPINLOCK_INITIALIZER; static void ldt_init(void); +/* in _curthread.S */ +extern void _set_gs(int); + /* * Initialize the array of ldt_entries and the next free slot. * This routine must be called with the global ldt lock held. diff --git a/lib/libthr/thread/thr_autoinit.c b/lib/libthr/thread/thr_autoinit.c index 31e2d48..c425569 100644 --- a/lib/libthr/thread/thr_autoinit.c +++ b/lib/libthr/thread/thr_autoinit.c @@ -33,6 +33,10 @@ * $FreeBSD$ */ +#include + +#include "thr_private.h" + /* * This module uses GCC extentions to initialize the * threads package at program start-up time. diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c index 2d6d765..ec2bfb6 100644 --- a/lib/libthr/thread/thr_cancel.c +++ b/lib/libthr/thread/thr_cancel.c @@ -4,6 +4,7 @@ */ #include #include +#include #include "thr_private.h" /* diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index 4fb29cb..334dc12 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -62,7 +62,6 @@ int _pthread_create(pthread_t * thread, const pthread_attr_t * attr, void *(*start_routine) (void *), void *arg) { - struct itimerval itimer; int f_gc = 0; int ret = 0; pthread_t gc_thread; diff --git a/lib/libthr/thread/thr_detach.c b/lib/libthr/thread/thr_detach.c index b60dc5c..b11728e 100644 --- a/lib/libthr/thread/thr_detach.c +++ b/lib/libthr/thread/thr_detach.c @@ -33,6 +33,7 @@ */ #include #include +#include #include "thr_private.h" __weak_reference(_pthread_detach, pthread_detach); diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index e394324..118876f 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -42,6 +42,9 @@ __weak_reference(_pthread_exit, pthread_exit); +/* thr_exit() */ +extern int _thr_exit(void); + void _thread_exit(char *fname, int lineno, char *string) { diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 64a1315..3b59da4 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -158,7 +158,6 @@ _thread_init(void) { struct pthread *pthread; int fd; - int flags; int i; size_t len; int mib[2]; @@ -328,7 +327,7 @@ _thread_init(void) /* Initialise the garbage collector mutex and condition variable. */ if (_pthread_mutex_init(&_gc_mutex,NULL) != 0 || - pthread_cond_init(&_gc_cond,NULL) != 0) + _pthread_cond_init(&_gc_cond,NULL) != 0) PANIC("Failed to initialise garbage collector mutex or condvar"); } diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c index 2945cc3..7d10c5f 100644 --- a/lib/libthr/thread/thr_kern.c +++ b/lib/libthr/thread/thr_kern.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -80,7 +81,6 @@ void _thread_critical_exit(pthread_t pthread) { sigset_t set; - int error; /* * restore is protected by giant. We could restore our signal state diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index c6c80b4..aa3a96f 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -64,6 +64,7 @@ */ static int get_muncontested(pthread_mutex_t, int); static void get_mcontested(pthread_mutex_t); +static int mutex_lock_common(pthread_mutex_t *, int); static inline int mutex_self_trylock(pthread_mutex_t); static inline int mutex_self_lock(pthread_mutex_t); static inline int mutex_unlock_common(pthread_mutex_t *, int); @@ -1381,13 +1382,14 @@ mutex_queue_enq(pthread_mutex_t mutex, pthread_t pthread) static int get_muncontested(pthread_mutex_t mutexp, int nonblock) { - if (mutexp->m_owner != NULL && mutexp->m_owner != curthread) + if (mutexp->m_owner != NULL && mutexp->m_owner != curthread) { return (-1); - else if (mutexp->m_owner == curthread) + } else if (mutexp->m_owner == curthread) { if (nonblock) return (mutex_self_trylock(mutexp)); else return (mutex_self_lock(mutexp)); + } /* * The mutex belongs to this thread now. Mark it as diff --git a/lib/libthr/thread/thr_printf.c b/lib/libthr/thread/thr_printf.c index 0da9ae5..3a120e8 100644 --- a/lib/libthr/thread/thr_printf.c +++ b/lib/libthr/thread/thr_printf.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index 8162309..f0cfd56 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -718,7 +718,7 @@ void *_thread_cleanup(pthread_t); void _thread_cleanupspecific(void); void _thread_dump_info(void); void _thread_init(void); -void _thread_sig_wrapper(int sig, siginfo_t *info, ucontext_t *context); +void _thread_sig_wrapper(int sig, siginfo_t *info, void *context); void _thread_printf(int fd, const char *, ...); void _thread_start(void); void _thread_seterrno(pthread_t, int); diff --git a/lib/libthr/thread/thr_resume_np.c b/lib/libthr/thread/thr_resume_np.c index 4d499fd..26b4d07 100644 --- a/lib/libthr/thread/thr_resume_np.c +++ b/lib/libthr/thread/thr_resume_np.c @@ -33,6 +33,7 @@ */ #include #include +#include #include "thr_private.h" static void resume_common(struct pthread *); diff --git a/lib/libthr/thread/thr_setschedparam.c b/lib/libthr/thread/thr_setschedparam.c index 7746383..04786a7 100644 --- a/lib/libthr/thread/thr_setschedparam.c +++ b/lib/libthr/thread/thr_setschedparam.c @@ -42,7 +42,10 @@ int _pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *param) { - int old_prio, in_readyq = 0, ret = 0; + int old_prio, ret = 0; +#if 0 + int in_readyq = 0; +#endif if ((param == NULL) || (policy < SCHED_FIFO) || (policy > SCHED_RR)) return (EINVAL); diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 51479af..a9f7f83 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -113,7 +113,7 @@ _pthread_kill(pthread_t pthread, int sig) * User thread signal handler wrapper. */ void -_thread_sig_wrapper(int sig, siginfo_t *info, ucontext_t *context) +_thread_sig_wrapper(int sig, siginfo_t *info, void *context) { struct pthread_state_data psd; __siginfohandler_t *handler; @@ -149,7 +149,7 @@ _thread_sig_wrapper(int sig, siginfo_t *info, ucontext_t *context) GIANT_UNLOCK(curthread); handler = (__siginfohandler_t *) _thread_sigact[sig - 1].sa_handler; - handler(sig, info, context); + handler(sig, info, (ucontext_t *)context); GIANT_LOCK(curthread); } diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index d8fa348..f5c609a 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -90,6 +90,16 @@ #include "thr_private.h" +extern int __creat(const char *, mode_t); +extern int __sleep(unsigned int); +extern int __sys_nanosleep(const struct timespec *, struct timespec *); +extern int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int __system(const char *); +extern int __tcdrain(int); +extern pid_t __wait(int *); +extern pid_t _wait4(pid_t, int *, int, struct rusage *); +extern pid_t __waitpid(pid_t, int *, int); + __weak_reference(_aio_suspend, aio_suspend); int -- cgit v1.1