Xenomai API  2.6.5
compiler.h
1 /*
2  * Copyright (C) 2001-2006 Philippe Gerum <[email protected]>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 
20 #ifndef _XENO_NUCLEUS_COMPILER_H
21 #define _XENO_NUCLEUS_COMPILER_H
22 
23 #if !defined(__IN_XENOMAI__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0))
24 #define __deprecated_call__ __attribute__((deprecated))
25 #ifdef __KERNEL__
26 #ifdef CONFIG_XENO_OPT_NOWARN_DEPRECATED
27 #define __deprecated_in_kernel__
28 #else
29 #define __deprecated_in_kernel__ __deprecated_call__
30 #endif /* CONFIG_XENO_OPT_NOWARN_DEPRECATED */
31 #else
32 #define __deprecated_in_kernel__
33 #endif /* !__KERNEL__ */
34 #else /* __IN_XENOMAI__ || !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)) */
35 #define __deprecated_in_kernel__
36 #endif /* __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) */
37 
38 #ifdef __IN_XENO__
39 #if __GNUC__ == 4 && __GNUC_MINOR__ == 6
40 #define __constructor__ __attribute__((constructor, noclone))
41 #else /* Gcc not 4.6 */
42 #define __constructor__ __attribute__((constructor))
43 #endif /* Gcc not 4.6 */
44 #endif /* In xenomai */
45 
46 #ifndef likely
47 #if !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 96
48 #define __builtin_expect(x, v) (x)
49 #endif /* !gcc or gcc version < 2.96 */
50 
51 #define likely(x) __builtin_expect((x) != 0, 1)
52 #define unlikely(x) __builtin_expect((x) != 0, 0)
53 #endif /* !defined(likely) */
54 
55 #endif /* !_XENO_NUCLEUS_COMPILER_H */