29.12.2014 Views

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

RealView Compilation Tools Compiler Reference Guide - ARM ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Compiler</strong>-specific Features<br />

4.5 Variable attributes<br />

The __attribute__ keyword enables you to specify special attributes of variables or<br />

structure fields, functions, and types. The keyword format is either:<br />

__attribute__ ((attribute1, attribute2, ...))<br />

__attribute__ ((__attribute1__, __attribute2__, ...))<br />

For example:<br />

void * Function_Attributes_malloc_0(int b) __attribute__ ((malloc));<br />

static int b __attribute__ ((__unused__));<br />

Table 4-3 on page 4-29 summarizes the available variable attributes.<br />

Table 4-5 Variable attributes supported by the compiler and their equivalents<br />

Variable attribute<br />

non-attribute equivalent<br />

__attribute__((alias)) -<br />

__attribute__((at(address))) -<br />

__attribute__((aligned)) -<br />

__attribute__((deprecated)) -<br />

__attribute__((packed)) -<br />

__attribute__((section)) -<br />

__attribute__((transparent_union)) -<br />

__attribute__((unused)) -<br />

__attribute__((used)) -<br />

__attribute__((weak))<br />

__weak<br />

__attribute__((zeroinit)) -<br />

4.5.1 __attribute__((alias))<br />

This variable attribute enables you to specify multiple aliases for variables.<br />

Where a variable is defined in the current translation unit, the alias reference is replaced<br />

by a reference to the variable, and the alias is emitted alongside the original name.<br />

Where a variable is not defined in the current translation unit, the alias reference is<br />

4-40 Copyright © 2007, 2010 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0348A<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!