xref: /openbsd-src/lib/librthread/namespace.h (revision 7567a0bfd62a817e7e35e58f2c676a7cbb063bc6)
1*7567a0bfSguenther /*	$OpenBSD: namespace.h,v 1.1 2016/04/02 19:56:53 guenther Exp $	*/
2*7567a0bfSguenther 
3*7567a0bfSguenther #ifndef _LIBPTHREAD_NAMESPACE_H_
4*7567a0bfSguenther #define _LIBPTHREAD_NAMESPACE_H_
5*7567a0bfSguenther 
6*7567a0bfSguenther /*
7*7567a0bfSguenther  * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
8*7567a0bfSguenther  *
9*7567a0bfSguenther  * Permission to use, copy, modify, and distribute this software for any
10*7567a0bfSguenther  * purpose with or without fee is hereby granted, provided that the above
11*7567a0bfSguenther  * copyright notice and this permission notice appear in all copies.
12*7567a0bfSguenther  *
13*7567a0bfSguenther  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14*7567a0bfSguenther  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15*7567a0bfSguenther  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16*7567a0bfSguenther  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17*7567a0bfSguenther  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18*7567a0bfSguenther  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19*7567a0bfSguenther  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20*7567a0bfSguenther  */
21*7567a0bfSguenther 
22*7567a0bfSguenther #include <sys/cdefs.h>	/* for __dso_hidden and __strong_alias */
23*7567a0bfSguenther 
24*7567a0bfSguenther #ifndef PIC
25*7567a0bfSguenther # define WEAK_IN_STATIC_ALIAS(x,y)      __weak_alias(x,y)
26*7567a0bfSguenther # define WEAK_IN_STATIC                 __attribute__((weak))
27*7567a0bfSguenther #else
28*7567a0bfSguenther # define WEAK_IN_STATIC_ALIAS(x,y)      __strong_alias(x,y)
29*7567a0bfSguenther # define WEAK_IN_STATIC                 /* nothing */
30*7567a0bfSguenther #endif
31*7567a0bfSguenther 
32*7567a0bfSguenther #define	HIDDEN(x)		_libpthread_##x
33*7567a0bfSguenther #define	HIDDEN_STRING(x)	"_libpthread_" __STRING(x)
34*7567a0bfSguenther 
35*7567a0bfSguenther #define	PROTO_NORMAL(x)		__dso_hidden typeof(x) x asm(HIDDEN_STRING(x))
36*7567a0bfSguenther #define	PROTO_STD_DEPRECATED(x)	typeof(x) x __attribute__((deprecated))
37*7567a0bfSguenther #define	PROTO_DEPRECATED(x)	PROTO_STD_DEPRECATED(x) WEAK_IN_STATIC
38*7567a0bfSguenther 
39*7567a0bfSguenther #define	DEF_STD(x)		__strong_alias(x, HIDDEN(x))
40*7567a0bfSguenther #define	DEF_NONSTD(x)		WEAK_IN_STATIC_ALIAS(x, HIDDEN(x))
41*7567a0bfSguenther 
42*7567a0bfSguenther #endif  /* _LIBPTHREAD_NAMESPACE_H_ */
43*7567a0bfSguenther 
44