summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2001-04-10 04:11:50 +0000
committerdeischen <deischen@FreeBSD.org>2001-04-10 04:11:50 +0000
commit3c4f2f3db28798206129ecb0f94e4aa3fa0dd106 (patch)
tree2b932f3e877b99e65db8b74c4098b7e9dbb1d7e8 /lib
parent9afc57514e4beba89a3e84ca17a0f1875a536dd5 (diff)
downloadFreeBSD-src-3c4f2f3db28798206129ecb0f94e4aa3fa0dd106.zip
FreeBSD-src-3c4f2f3db28798206129ecb0f94e4aa3fa0dd106.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/_pthread_stubs.c53
-rw-r--r--lib/libc/gen/_spinlock_stub.c7
-rw-r--r--lib/libc/gen/_thread_init.c6
-rw-r--r--lib/libc/stdio/_flock_stub.c8
-rw-r--r--lib/libc/sys/__error.c2
5 files changed, 39 insertions, 37 deletions
diff --git a/lib/libc/gen/_pthread_stubs.c b/lib/libc/gen/_pthread_stubs.c
index 4783359..8695741 100644
--- a/lib/libc/gen/_pthread_stubs.c
+++ b/lib/libc/gen/_pthread_stubs.c
@@ -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);
}
diff --git a/lib/libc/gen/_spinlock_stub.c b/lib/libc/gen/_spinlock_stub.c
index 071fc20..78c8dea 100644
--- a/lib/libc/gen/_spinlock_stub.c
+++ b/lib/libc/gen/_spinlock_stub.c
@@ -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.
diff --git a/lib/libc/gen/_thread_init.c b/lib/libc/gen/_thread_init.c
index d6be5f2..1d2f15a 100644
--- a/lib/libc/gen/_thread_init.c
+++ b/lib/libc/gen/_thread_init.c
@@ -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;
diff --git a/lib/libc/stdio/_flock_stub.c b/lib/libc/stdio/_flock_stub.c
index cc0cffe..2be797a 100644
--- a/lib/libc/stdio/_flock_stub.c
+++ b/lib/libc/stdio/_flock_stub.c
@@ -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
diff --git a/lib/libc/sys/__error.c b/lib/libc/sys/__error.c
index 8c14b0f..3641e77 100644
--- a/lib/libc/sys/__error.c
+++ b/lib/libc/sys/__error.c
@@ -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()
OpenPOWER on IntegriCloud