Initial commit
[kernel/linux-3.0.git] / drivers / gpu / vithar / kbase / malisw / arm_cstd / arm_cstd_types_rvct.h
1 /*
2  *
3  * (C) COPYRIGHT 2009-2011 ARM Limited. All rights reserved.
4  *
5  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
6  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
7  * 
8  * A copy of the licence is included with the program, and can also be obtained from Free Software
9  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
10  * 
11  */
12
13
14
15 #ifndef _ARM_CSTD_TYPES_RVCT_H_
16 #define _ARM_CSTD_TYPES_RVCT_H_
17
18 /* ============================================================================
19         Type definitions
20 ============================================================================ */
21 #include <stddef.h>
22 #include <limits.h>
23
24 #if 199901L <= __STDC_VERSION__
25         #include <inttypes.h>
26 #else
27         typedef unsigned char           uint8_t;
28         typedef signed char             int8_t;
29         typedef unsigned short          uint16_t;
30         typedef signed short            int16_t;
31         typedef unsigned int            uint32_t;
32         typedef signed int              int32_t;
33         typedef unsigned __int64        uint64_t;
34         typedef signed __int64          int64_t;
35         typedef ptrdiff_t               intptr_t;
36         typedef size_t                  uintptr_t;
37 #endif
38
39 typedef uint32_t                    bool_t;
40
41 #if !defined(TRUE)
42         #define TRUE                ((bool_t)1)
43 #endif
44
45 #if !defined(FALSE)
46         #define FALSE               ((bool_t)0)
47 #endif
48
49 /* ============================================================================
50         Keywords
51 ============================================================================ */
52 /**
53  * @addtogroup arm_cstd_coding_standard
54  * @{
55  */
56
57 /**
58  * @def ASM
59  * @hideinitializer
60  * Mark an assembler block. Such blocks are often compiler specific, so often
61  * need to be surrounded in appropriate @c ifdef and @c endif blocks
62  * using the relevant @c CSTD_TOOLCHAIN macro.
63  */
64 #define ASM                     __asm
65
66 /**
67  * @def INLINE
68  * @hideinitializer
69  * Mark a definition as something which should be inlined. This is not always
70  * possible on a given compiler, and may be disabled at lower optimization
71  * levels.
72  */
73 #define INLINE                  __inline
74
75 /**
76  * @def FORCE_INLINE
77  * @hideinitializer
78  * Mark a definition as something which should be inlined. This provides a much
79  * stronger hint to the compiler than @c INLINE, and if supported should always
80  * result in an inlined function being emitted. If not supported this falls
81  * back to using the @c INLINE definition.
82  */
83 #define FORCE_INLINE            __forceinline
84
85 /**
86  * @def NEVER_INLINE
87  * @hideinitializer
88  * Mark a definition as something which should not be inlined. This provides a
89  * stronger hint to the compiler than the function should not be inlined,
90  * bypassing any heuristic rules the compiler normally applies. If not
91  * supported by a toolchain this falls back to being an empty macro.
92  */
93 #define NEVER_INLINE            __declspec(noinline)
94
95 /**
96  * @def PURE
97  * @hideinitializer
98  * Denotes that a function's return is only dependent on its inputs, enabling
99  * more efficient optimizations. Falls back to an empty macro if not supported.
100  */
101 #define PURE                    __pure
102
103 /**
104  * @def PACKED
105  * @hideinitializer
106  * Denotes that a structure should be stored in a packed form. This macro must
107  * be used in conjunction with the @c arm_cstd_pack_* headers for portability:
108  *
109  * @code
110  * #include <cstd/arm_cstd_pack_push.h>
111  *
112  * struct PACKED myStruct {
113  *     ...
114  * };
115  *
116  * #include <cstd/arm_cstd_pack_pop.h>
117  * PACKED
118  * @endcode
119  */
120 #define PACKED                  __packed
121
122 /**
123  * @def UNALIGNED
124  * @hideinitializer
125  * Denotes that a pointer points to a buffer with lower alignment than the
126  * natural alignment required by the C standard. This should only be used
127  * in extreme cases, as the emitted code is normally more efficient if memory
128  * is aligned.
129  *
130  * @warning This is \b NON-PORTABLE. The GNU tools are anti-unaligned pointers
131  * and have no support for such a construction.
132  */
133 #define UNALIGNED               __packed
134
135 /**
136  * @def RESTRICT
137  * @hideinitializer
138  * Denotes that a pointer does not overlap with any other points currently in
139  * scope, increasing the range of optimizations which can be performed by the
140  * compiler.
141  *
142  * @warning Specification of @c RESTRICT is a contract between the programmer
143  * and the compiler. If you place @c RESTICT on buffers which do actually
144  * overlap the behavior is undefined, and likely to vary at different
145  * optimization levels.!
146  */
147 #define RESTRICT                __restrict
148
149 /**
150  * @def CHECK_RESULT
151  * @hideinitializer
152  * Function attribute which causes a warning to be emitted if the compiler's
153  * return value is not used by the caller. Compiles to an empty macro if
154  * there is no supported mechanism for this check in the underlying compiler.
155  *
156  * @note At the time of writing this is only supported by GCC. RVCT does not
157  * support this attribute, even in GCC mode, so engineers are encouraged to
158  * compile their code using GCC even if primarily working with another
159  * compiler.
160  *
161  * @code
162  * CHECK_RESULT int my_func( void );
163  * @endcode
164   */
165 #define CHECK_RESULT
166
167 /**
168  * @def CSTD_FUNC
169  * Specify the @c CSTD_FUNC macro, a portable construct containing the name of
170  * the current function. On most compilers it is illegal to use this macro
171  * outside of a function scope. If not supported by the compiler we define
172  * @c CSTD_FUNC as an empty string.
173  *
174  * @warning Due to the implementation of this on most modern compilers this
175  * expands to a magically defined "static const" variable, not a constant
176  * string. This makes injecting @c CSTD_FUNC directly in to compile-time
177  * strings impossible, so if you want to make the function name part of a
178  * larger string you must use a printf-like function with a @c @%s template
179  * which is populated with @c CSTD_FUNC
180  */
181 #define CSTD_FUNC            __FUNCTION__
182
183 /**
184  * @}
185  */
186
187 #endif /* End (_ARM_CSTD_TYPES_RVCT_H_) */