To be consistent, use the __weak_reference macro from <sys/cdefs.h>

instead of #pragma weak to create weak definitions.  This macro is
improperly named, though, since a weak definition is not the same
thing as a weak reference.

Suggested by:	bde
This commit is contained in:
Daniel Eischen 2001-04-10 04:11:50 +00:00
parent 278d1a20e8
commit 54fd7f685f
5 changed files with 39 additions and 37 deletions

View File

@ -39,31 +39,31 @@
* between application locks and libc locks (threads holding the
* latter can't be allowed to exit/terminate).
*/
#pragma weak _pthread_cond_init=_pthread_cond_init_stub
#pragma weak _pthread_cond_signal=_pthread_cond_signal_stub
#pragma weak _pthread_cond_wait=_pthread_cond_wait_stub
#pragma weak _pthread_getspecific=_pthread_getspecific_stub
#pragma weak _pthread_key_create=_pthread_key_create_stub
#pragma weak _pthread_key_delete=_pthread_key_delete_stub
#pragma weak _pthread_main_np=_pthread_main_np_stub
#pragma weak _pthread_mutex_destroy=_pthread_mutex_destroy_stub
#pragma weak _pthread_mutex_init=_pthread_mutex_init_stub
#pragma weak _pthread_mutex_lock=_pthread_mutex_lock_stub
#pragma weak _pthread_mutex_trylock=_pthread_mutex_trylock_stub
#pragma weak _pthread_mutex_unlock=_pthread_mutex_unlock_stub
#pragma weak _pthread_mutexattr_init=_pthread_mutexattr_init_stub
#pragma weak _pthread_mutexattr_destroy=_pthread_mutexattr_destroy_stub
#pragma weak _pthread_mutexattr_settype=_pthread_mutexattr_settype_stub
#pragma weak _pthread_once=_pthread_once_stub
#pragma weak _pthread_self=_pthread_self_stub
#pragma weak _pthread_rwlock_init=_pthread_rwlock_init_stub
#pragma weak _pthread_rwlock_rdlock=_pthread_rwlock_rdlock_stub
#pragma weak _pthread_rwlock_tryrdlock=_pthread_rwlock_tryrdlock_stub
#pragma weak _pthread_rwlock_trywrloc=_pthread_rwlock_trywrlock_stub
#pragma weak _pthread_rwlock_unlock=_pthread_rwlock_unlock_stub
#pragma weak _pthread_rwlock_wrlock=_pthread_rwlock_wrlock_stub
#pragma weak _pthread_setspecific=_pthread_setspecific_stub
#pragma weak _pthread_sigmask=_pthread_sigmask_stub
__weak_reference(_pthread_cond_init_stub, _pthread_cond_init);
__weak_reference(_pthread_cond_signal_stub, _pthread_cond_signal);
__weak_reference(_pthread_cond_wait_stub, _pthread_cond_wait);
__weak_reference(_pthread_getspecific_stub, _pthread_getspecific);
__weak_reference(_pthread_key_create_stub, _pthread_key_create);
__weak_reference(_pthread_key_delete_stub, _pthread_key_delete);
__weak_reference(_pthread_main_np_stub, _pthread_main_np);
__weak_reference(_pthread_mutex_destroy_stub, _pthread_mutex_destroy);
__weak_reference(_pthread_mutex_init_stub, _pthread_mutex_init);
__weak_reference(_pthread_mutex_lock_stub, _pthread_mutex_lock);
__weak_reference(_pthread_mutex_trylock_stub, _pthread_mutex_trylock);
__weak_reference(_pthread_mutex_unlock_stub, _pthread_mutex_unlock);
__weak_reference(_pthread_mutexattr_init_stub, _pthread_mutexattr_init);
__weak_reference(_pthread_mutexattr_destroy_stub, _pthread_mutexattr_destroy);
__weak_reference(_pthread_mutexattr_settype_stub, _pthread_mutexattr_settype);
__weak_reference(_pthread_once_stub, _pthread_once);
__weak_reference(_pthread_self_stub, _pthread_self);
__weak_reference(_pthread_rwlock_init_stub, _pthread_rwlock_init);
__weak_reference(_pthread_rwlock_rdlock_stub, _pthread_rwlock_rdlock);
__weak_reference(_pthread_rwlock_tryrdlock_stub, _pthread_rwlock_tryrdlock);
__weak_reference(_pthread_rwlock_trywrlock_stub, _pthread_rwlock_trywrloc);
__weak_reference(_pthread_rwlock_unlock_stub, _pthread_rwlock_unlock);
__weak_reference(_pthread_rwlock_wrlock_stub, _pthread_rwlock_wrlock);
__weak_reference(_pthread_setspecific_stub, _pthread_setspecific);
__weak_reference(_pthread_sigmask_stub, _pthread_sigmask);
/* Define a null pthread structure just to satisfy _pthread_self. */
struct pthread {
@ -85,8 +85,7 @@ _pthread_cond_signal_stub(pthread_cond_t *cond)
}
int
_pthread_cond_wait_stub(pthread_cond_t *cond,
pthread_mutex_t *mutex)
_pthread_cond_wait_stub(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
return (0);
}

View File

@ -41,9 +41,10 @@
* Declare weak definitions in case the application is not linked
* with libpthread.
*/
#pragma weak _atomic_lock=_atomic_lock_stub
#pragma weak _spinlock=_spinlock_stub
#pragma weak _spinlock_debug=_spinlock_debug_stub
__weak_reference(_atomic_lock_stub, _atomic_lock);
__weak_reference(_spinlock_stub, _spinlock);
__weak_reference(_spinlock_debug_stub, _spinlock_debug);
/*
* This function is a stub for the _atomic_lock function in libpthread.

View File

@ -26,8 +26,10 @@
* $FreeBSD$
*/
#pragma weak _thread_init=_thread_init_stub
#pragma weak _thread_autoinit_dummy_decl=_thread_autoinit_dummy_decl_stub
#include <sys/types.h>
__weak_reference(_thread_init_stub, _thread_init);
__weak_reference(_thread_autoinit_dummy_decl_stub, _thread_autoinit_dummy_decl);
int _thread_autoinit_dummy_decl_stub = 0;

View File

@ -53,10 +53,10 @@
/*
* Weak symbols for externally visible functions in this file:
*/
#pragma weak flockfile=_flockfile
#pragma weak _flockfile_debug=_flockfile_debug_stub
#pragma weak ftrylockfile=_ftrylockfile
#pragma weak funlockfile=_funlockfile
__weak_reference(_flockfile, flockfile);
__weak_reference(_flockfile_debug_stub, _flockfile_debug);
__weak_reference(_ftrylockfile, ftrylockfile);
__weak_reference(_funlockfile, funlockfile);
/*
* We need to retain binary compatibility for a while. So pretend

View File

@ -40,7 +40,7 @@ extern int errno;
* Declare a weak reference in case the application is not linked
* with libpthread.
*/
#pragma weak __error=__error_unthreaded
__weak_reference(__error_unthreaded, __error);
int *
__error_unthreaded()