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.4 Type 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-4 summarizes the available type attributes.<br />

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

Type attribute<br />

__attribute__((aligned))<br />

__attribute__((packed))<br />

non-attribute equivalent<br />

__align<br />

__packed a<br />

__attribute__((transparent_union)) -<br />

a. The __packed qualifier does not affect type in GNU mode.<br />

4.4.1 __attribute__((aligned))<br />

The aligned type attribute specifies a minimum alignment for the type.<br />

Note<br />

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

4.4.2 __attribute((packed))<br />

The packed type attribute specifies that a type must have the smallest possible alignment.<br />

Note<br />

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

Errors<br />

The compiler generates a warning message if you use this attribute in a typedef.<br />

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

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!