LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Attributes.h
Go to the documentation of this file.
1 /*
2  * @brief Compilers's specific attributes
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * Copyright(C) Dean Camera, 2011, 2012
7  * All rights reserved.
8  *
9  * @par
10  * Software that is described herein is for illustrative purposes only
11  * which provides customers with programming information regarding the
12  * LPC products. This software is supplied "AS IS" without any warranties of
13  * any kind, and NXP Semiconductors and its licensor disclaim any and
14  * all warranties, express or implied, including all implied warranties of
15  * merchantability, fitness for a particular purpose and non-infringement of
16  * intellectual property rights. NXP Semiconductors assumes no responsibility
17  * or liability for the use of the software, conveys no license or rights under any
18  * patent, copyright, mask work right, or any other intellectual property rights in
19  * or to any products. NXP Semiconductors reserves the right to make changes
20  * in the software without notification. NXP Semiconductors also makes no
21  * representation or warranty that such application will be suitable for the
22  * specified use without further testing or modification.
23  *
24  * @par
25  * Permission to use, copy, modify, and distribute this software and its
26  * documentation is hereby granted, under NXP Semiconductors' and its
27  * licensor's relevant copyrights in the software, without fee, provided that it
28  * is used in conjunction with NXP Semiconductors microcontrollers. This
29  * copyright, permission, and disclaimer notice must appear in all copies of
30  * this code.
31 */
32 
33 
34 
50 #ifndef __LPCUSBlib_FUNCATTR_H__
51 #define __LPCUSBlib_FUNCATTR_H__
52 
53  /* Preprocessor Checks: */
54  #if !defined(__INCLUDE_FROM_COMMON_H)
55  #error Do not include this file directly. Include LPCUSBlib/Common/Common.h instead to gain this functionality.
56  #endif
57 
58  /* Public Interface - May be used in end-application: */
59  /* Macros: */
60  #if (__GNUC__ >= 3) || defined(__DOXYGEN__)
61 
64  #define ATTR_NO_RETURN __attribute__ ((noreturn))
65 
69  #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
70 
75  #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__)))
76 
81  #define ATTR_NAKED __attribute__ ((naked))
82 
86  #define ATTR_NO_INLINE __attribute__ ((noinline))
87 
91  #define PRAGMA_ALWAYS_INLINE
92  #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
93 
97  #define ATTR_PURE __attribute__ ((pure))
98 
102  #define ATTR_CONST __attribute__ ((const))
103 
105  #define ATTR_DEPRECATED __attribute__ ((deprecated))
106 
110  #define PRAGMA_WEAK(func,alias)
111  #define ATTR_WEAK __attribute__ ((weak))
112 
117  #define ATTR_ALIAS(Func) __attribute__ ((alias( #Func )))
118 
124  #define ATTR_NO_INIT __attribute__ ((section (".noinit")))
125 
129  #define PRAGMA_ALIGN_4096
130  #define PRAGMA_ALIGN_2048
131  #define PRAGMA_ALIGN_256
132  #define PRAGMA_ALIGN_128
133  #define PRAGMA_ALIGN_64
134  #define PRAGMA_ALIGN_48
135  #define PRAGMA_ALIGN_32
136  #define PRAGMA_ALIGN_4
137  #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
138 
139  #define ATTR_DEPRECATED __attribute__ ((deprecated))
140 #if defined (__CC_ARM)
141  #define ATTR_ERROR(Message) //__attribute__ (( error(Message) ))
142 #else
143  #define ATTR_ERROR(Message) __attribute__ (( error(Message) ))
144 #endif
145  #define ATTR_WARNING(Message) __attribute__ (( warning(Message) ))
146  #define ATTR_IAR_PACKED
147  #define ATTR_PACKED __attribute__ ((packed))
148  #endif
149 
150  #if defined(__ICCARM__)
151 
155  #define ATTR_NO_RETURN
156 
160  #define ATTR_WARN_UNUSED_RESULT
161 
166  #define ATTR_NON_NULL_PTR_ARG(...)
167 
172  #define ATTR_NAKED __attribute__ ((naked))
173 
177  #define ATTR_NO_INLINE __attribute__ ((noinline))
178 
182  #define PRAGMA_ALWAYS_INLINE _Pragma("inline=forced")
183  #define ATTR_ALWAYS_INLINE
184 
188  #define ATTR_PURE __attribute__ ((pure))
189 
193  #define ATTR_CONST
194 
196  #define ATTR_DEPRECATED// __attribute__ ((deprecated))
197 
201  #define _PPTOSTR_(x) #x
202  #define PRAGMA_WEAK(name, vector) _Pragma(_PPTOSTR_(weak name=vector))
203  #define ATTR_WEAK
204 
209  #define ATTR_ALIAS(Func)
210 
216  #define ATTR_NO_INIT __attribute__ ((section (".noinit")))
217 
221  #define PRAGMA_ALIGN_4096 _Pragma("data_alignment=4096")
222  #define PRAGMA_ALIGN_2048 _Pragma("data_alignment=2048")
223  #define PRAGMA_ALIGN_256 _Pragma("data_alignment=256")
224  #define PRAGMA_ALIGN_128 _Pragma("data_alignment=128")
225  #define PRAGMA_ALIGN_64 _Pragma("data_alignment=64")
226  #define PRAGMA_ALIGN_48 _Pragma("data_alignment=48")
227  #define PRAGMA_ALIGN_32 _Pragma("data_alignment=32")
228  #define PRAGMA_ALIGN_4 _Pragma("data_alignment=4")
229  #define ATTR_ALIGNED(Bytes)
230 
231  //#define ATTR_DEPRECATED __attribute__ ((deprecated))
232 
233  #define ATTR_ERROR(Message)// __attribute__ (( error(Message) ))
234 
235  #define ATTR_WARNING(Message) // __attribute__ (( warning(Message) ))
236 
237  #define ATTR_IAR_PACKED __packed
238 
239  #define ATTR_PACKED
240 
241  #endif
242 
248  #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((naked, section (".init" #SectionIndex )))
249 
253 #endif
254