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.3 Function 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 summarizes the available function attributes.<br />

Table 4-3 Function attributes supported by the compiler and their equivalents<br />

Function attribute<br />

non-attribute equivalent<br />

__attribute__((alias)) -<br />

__attribute__((always_inline))<br />

__attribute__((const))<br />

__forceinline<br />

__pure<br />

__attribute__((deprecated)) -<br />

__attribute__((malloc)) -<br />

__attribute__((noinline))<br />

__attribute__((noreturn))<br />

__declspec(noinline)<br />

__declspec(noreturn))<br />

__attribute__((pure)) -<br />

__attribute__((unused)) -<br />

__attribute__((used)) -<br />

__attribute__((weak))<br />

__weak<br />

4.3.1 __attribute__((alias))<br />

This function attribute enables you to specify multiple aliases for functions.<br />

Where a function is defined in the current translation unit, the alias call is replaced by a<br />

call to the function, and the alias is emitted alongside the original name. Where a<br />

function is not defined in the current translation unit, the alias call is replaced by a call<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!