04.01.2015 Views

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

RealView Compilation Tools - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Compiler-specific Features<br />

4.3.11 __attribute__((notailcall))<br />

This function attribute prevents tailcalling of the function. That is, the function is always<br />

called with a branch-and-link even if (because the call occurs at the end of a function)<br />

it could be transferred to by a branch.<br />

See also<br />

• __attribute__((nomerge)) on page 4-35<br />

• --retain=option on page 2-113.<br />

4.3.12 __attribute__((pure))<br />

Many functions have no effects except to return a value, and that the return value<br />

depends only on the parameters and global variables. Functions of this kind can be<br />

subject to data flow analysis and might be eliminated.<br />

Note<br />

This function attribute is a GNU compiler extension that is supported by the <strong>ARM</strong><br />

compiler.<br />

Although related, this function attribute is not equivalent to the __pure keyword. The<br />

function attribute equivalent to __pure is __attribute__((const)).<br />

Example<br />

int Function_Attributes_pure_0(int b) __attribute__ ((pure));<br />

int Function_Attributes_pure_0(int b)<br />

{<br />

static int aStatic;<br />

aStatic++;<br />

return b++;<br />

}<br />

int Function_Attributes_pure_2(int b)<br />

{<br />

int aLocal=0;<br />

aLocal += Function_Attributes_pure_0(b);<br />

return 0;<br />

}<br />

The call to Function_Attributes_pure_0 in this example might be eliminated because its<br />

result is not used.<br />

<strong>ARM</strong> DUI 0348C Copyright © 2007-2010 <strong>ARM</strong>. All rights reserved. 4-37<br />

ID101213<br />

Non-Confidential,

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

Saved successfully!

Ooh no, something went wrong!