LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Function/Variable Attributes

Special function/variable attribute macros. More...

Macros

#define ATTR_NO_RETURN   __attribute__ ((noreturn))
 
#define ATTR_WARN_UNUSED_RESULT   __attribute__ ((warn_unused_result))
 
#define ATTR_NON_NULL_PTR_ARG(...)   __attribute__ ((nonnull (__VA_ARGS__)))
 
#define ATTR_NAKED   __attribute__ ((naked))
 
#define ATTR_NO_INLINE   __attribute__ ((noinline))
 
#define PRAGMA_ALWAYS_INLINE
 
#define ATTR_ALWAYS_INLINE   __attribute__ ((always_inline))
 
#define ATTR_PURE   __attribute__ ((pure))
 
#define ATTR_CONST   __attribute__ ((const))
 
#define ATTR_DEPRECATED   __attribute__ ((deprecated))
 
#define ATTR_DEPRECATED   __attribute__ ((deprecated))
 
#define PRAGMA_WEAK(func, alias)
 
#define ATTR_WEAK   __attribute__ ((weak))
 
#define ATTR_ALIAS(Func)   __attribute__ ((alias( #Func )))
 
#define ATTR_NO_INIT   __attribute__ ((section (".noinit")))
 
#define PRAGMA_ALIGN_4096
 
#define PRAGMA_ALIGN_2048
 
#define PRAGMA_ALIGN_256
 
#define PRAGMA_ALIGN_128
 
#define PRAGMA_ALIGN_64
 
#define PRAGMA_ALIGN_48
 
#define PRAGMA_ALIGN_32
 
#define PRAGMA_ALIGN_4
 
#define ATTR_ALIGNED(Bytes)   __attribute__ ((aligned(Bytes)))
 
#define ATTR_ERROR(Message)   __attribute__ (( error(Message) ))
 
#define ATTR_WARNING(Message)   __attribute__ (( warning(Message) ))
 
#define ATTR_IAR_PACKED
 
#define ATTR_PACKED   __attribute__ ((packed))
 
#define ATTR_INIT_SECTION(SectionIndex)   __attribute__ ((naked, section (".init" #SectionIndex )))
 

Detailed Description

Special function/variable attribute macros.

This module contains macros for applying specific attributes to functions and variables to control various optimizer and code generation features of the compiler. Attributes may be placed in the function prototype or variable declaration in any order, and multiple attributes can be specified for a single item via a space separated list.

On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are critical to the code's function and thus must throw a compile error when used.

Macro Definition Documentation

#define ATTR_ALIAS (   Func)    __attribute__ ((alias( #Func )))

Marks a function as an alias for another function.

Parameters
FuncName of the function which the given function name should alias.

Definition at line 117 of file Attributes.h.

#define ATTR_ALIGNED (   Bytes)    __attribute__ ((aligned(Bytes)))

Definition at line 137 of file Attributes.h.

#define ATTR_ALWAYS_INLINE   __attribute__ ((always_inline))

Definition at line 92 of file Attributes.h.

#define ATTR_CONST   __attribute__ ((const))

Indicates that the specified function is constant, in that it has no side effects other than parameter access.

Definition at line 102 of file Attributes.h.

#define ATTR_DEPRECATED   __attribute__ ((deprecated))

Marks a given function as deprecated, which produces a warning if the function is called.

Definition at line 139 of file Attributes.h.

#define ATTR_DEPRECATED   __attribute__ ((deprecated))

Marks a given function as deprecated, which produces a warning if the function is called.

Definition at line 139 of file Attributes.h.

#define ATTR_ERROR (   Message)    __attribute__ (( error(Message) ))

Definition at line 143 of file Attributes.h.

#define ATTR_IAR_PACKED

Definition at line 146 of file Attributes.h.

#define ATTR_INIT_SECTION (   SectionIndex)    __attribute__ ((naked, section (".init" #SectionIndex )))

Places the function in one of the initialization sections, which execute before the main function of the application. Refer to the avr-libc manual for more information on the initialization sections.

Parameters
SectionIndexInitialization section number where the function should be placed.

Definition at line 248 of file Attributes.h.

#define ATTR_NAKED   __attribute__ ((naked))

Removes any preamble or postamble from the function. When used, the function will not have any register or stack saving code. This should be used with caution, and when used the programmer is responsible for maintaining stack and register integrity.

Definition at line 81 of file Attributes.h.

#define ATTR_NO_INIT   __attribute__ ((section (".noinit")))

Forces the compiler to not automatically zero the given global variable on startup, so that the current RAM contents is retained. Under most conditions this value will be random due to the behaviour of volatile memory once power is removed, but may be used in some specific circumstances, like the passing of values back after a system watchdog reset.

Definition at line 124 of file Attributes.h.

#define ATTR_NO_INLINE   __attribute__ ((noinline))

Prevents the compiler from considering a specified function for in-lining. When applied, the given function will not be in-lined under any circumstances.

Definition at line 86 of file Attributes.h.

#define ATTR_NO_RETURN   __attribute__ ((noreturn))

Indicates to the compiler that the function can not ever return, so that any stack restoring or return code may be omitted by the compiler in the resulting binary.

Definition at line 64 of file Attributes.h.

#define ATTR_NON_NULL_PTR_ARG (   ...)    __attribute__ ((nonnull (__VA_ARGS__)))

Indicates that the specified parameters of the function are pointers which should never be NULL. When applied as a 1-based comma separated list the compiler will emit a warning if the specified parameters are known at compiler time to be NULL at the point of calling the function.

Definition at line 75 of file Attributes.h.

#define ATTR_PACKED   __attribute__ ((packed))

Definition at line 147 of file Attributes.h.

#define ATTR_PURE   __attribute__ ((pure))

Indicates that the specified function is pure, in that it has no side-effects other than global or parameter variable access.

Definition at line 97 of file Attributes.h.

#define ATTR_WARN_UNUSED_RESULT   __attribute__ ((warn_unused_result))

Indicates that the function returns a value which should not be ignored by the user code. When applied, any ignored return value from calling the function will produce a compiler warning.

Definition at line 69 of file Attributes.h.

#define ATTR_WARNING (   Message)    __attribute__ (( warning(Message) ))

Definition at line 145 of file Attributes.h.

#define ATTR_WEAK   __attribute__ ((weak))

Definition at line 111 of file Attributes.h.

#define PRAGMA_ALIGN_128

Definition at line 132 of file Attributes.h.

#define PRAGMA_ALIGN_2048

Definition at line 130 of file Attributes.h.

#define PRAGMA_ALIGN_256

Definition at line 131 of file Attributes.h.

#define PRAGMA_ALIGN_32

Definition at line 135 of file Attributes.h.

#define PRAGMA_ALIGN_4

Definition at line 136 of file Attributes.h.

#define PRAGMA_ALIGN_4096

Indicates the minimum alignment in bytes for a variable or struct element.

Parameters
BytesMinimum number of bytes the item should be aligned to.

Definition at line 129 of file Attributes.h.

#define PRAGMA_ALIGN_48

Definition at line 134 of file Attributes.h.

#define PRAGMA_ALIGN_64

Definition at line 133 of file Attributes.h.

#define PRAGMA_ALWAYS_INLINE

Forces the compiler to inline the specified function. When applied, the given function will be in-lined under all circumstances.

Definition at line 91 of file Attributes.h.

#define PRAGMA_WEAK (   func,
  alias 
)

Marks a function as a weak reference, which can be overridden by other functions with an identical name (in which case the weak reference is discarded at link time).

Definition at line 110 of file Attributes.h.