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