Xenomai  3.0.5
trank.h
1 /*
2  * Copyright (C) 2014 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17  */
18 #ifndef _XENOMAI_TRANK_TRANK_H
19 #define _XENOMAI_TRANK_TRANK_H
20 
21 #include <boilerplate/compiler.h>
22 
23 #ifdef __XENO_COMPAT__
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 void warning(const char *fmt, ...);
30 
31 #ifdef __cplusplus
32 }
33 #endif
34 
35 #define trank_warning(__fmt, __args...) \
36  warning("%s: " __fmt, __func__, ##__args)
37 
38 #define __CURRENT(call) __current_ ## call
39 
40 #define COMPAT_DECL(T, P) __typeof__(T) P
41 #define CURRENT_DECL(T, P) __typeof__(T) __CURRENT(P)
42 
43 #else /* !__XENO_COMPAT__ */
44 
45 #define __CURRENT(call) call
46 
47 #define COMPAT_DECL(T, P)
48 #define CURRENT_DECL(T, P) __typeof__(T) P; \
49  __typeof__(T) __current_ ## P
50 
51 #define CURRENT_IMPL(T, I, A) \
52 __typeof__(T) I A __attribute__((alias("__current_" __stringify(I)), weak)); \
53 __typeof__(T) __current_ ## I A
54 
55 #endif /* !__XENO_COMPAT__ */
56 
57 #endif /* _XENOMAI_TRANK_TRANK_H */