Fawkes API  Fawkes Development Version
macros.h
1 
2 /***************************************************************************
3  * macros.h - important macros
4  *
5  * Created: Mon Dec 03 13:52:05 2007
6  * Copyright 2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __CORE_MACROS_H_
25 #define __CORE_MACROS_H_
26 
27 // from http://blog.rlove.org/2005_10_01_archive.html
28 // Note that __GNUC__ is also set appropriately by the Intel compiler
29 #if __GNUC__ >= 3
30 # ifndef __inline
31 # define __inline inline __attribute__ ((__always_inline__))
32 # endif
33 # ifndef __pure
34 # define __pure __attribute__ ((__pure__))
35 # endif
36 # define __const_ __attribute__ ((__const__))
37 # define __noreturn __attribute__ ((__noreturn__))
38 # define __malloc __attribute__ ((__malloc__))
39 # define __must_check __attribute__ ((__warn_unused_result__))
40 # ifndef __deprecated
41 # define __deprecated __attribute__ ((__deprecated__))
42 # endif
43 # ifndef __used
44 # define __used __attribute__ ((__used__))
45 # endif
46 # ifndef __unused
47 # define __unused __attribute__ ((__unused__))
48 # endif
49 # ifndef __packed
50 # define __packed __attribute__ ((__packed__))
51 # endif
52 # ifndef __aligned
53 # define __aligned(x) __attribute__ ((__aligned__ (x)))
54 # endif
55 # define likely(x) __builtin_expect (!!(x), 1)
56 # define unlikely(x) __builtin_expect (!!(x), 0)
57 #else
58 # ifndef __inline
59 # define __inline /* no inline */
60 # endif
61 # ifndef __pure
62 # define __pure /* no pure */
63 # endif
64 # define __const_ /* no const */
65 # define __noreturn /* no noreturn */
66 # define __malloc /* no malloc */
67 # define __must_check /* no warn_unused_result */
68 # define __deprecated /* no deprecated */
69 # ifndef __used
70 # define __used /* no used */
71 # endif
72 # ifndef __unused
73 # define __unused /* no unused */
74 # endif
75 # ifndef __packed
76 # define __packed /* no packed */
77 # endif
78 # ifndef __aligned
79 # define __aligned(x) /* no align */
80 # endif
81 # define likely(x) (x)
82 # define unlikely(x) (x)
83 #endif
84 
85 #endif