Variable attributes

The __attribute__ keyword enables you to specify special attributes of variables or structure fields, functions, and types. The keyword format is either of the following:

__attribute__((attribute1, attribute2, ...))
__attribute__((__attribute1__, __attribute2__, ...))

For example:

void * Function_Attributes_malloc_0(int b) __attribute__((malloc));
static int b __attribute__((__unused__));

Table 12 summarizes the available variable attributes.

Table 12. Variable attributes supported by the compiler and their equivalents

Variable attributeNon-attribute equivalent
__attribute__((alias))-
__attribute__((at(address)))-
__attribute__((aligned))-
__attribute__((deprecated))-
__attribute__((noinline)) 
__attribute__((packed))-
__attribute__((section("name")))-
__attribute__((transparent_union))-
__attribute__((unused))-
__attribute__((used))-
__attribute__((visibility("visibility_type")))-
__attribute__((weak))__weak
__attribute__((weakref("target"))) 
__attribute__((zeroinit))-

Copyright © 2010-2012 ARM. All rights reserved.ARM DUI 0491H
Non-ConfidentialID070912