13.07.2015 Views

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

TASKING VX-toolset for ARM User Guide

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.

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>exportYou can use __attribute__((export)) to specify that a variable/function has external linkage andshould not be removed. During MIL linking, the compiler treats external definitions at file scope as if theywere declared static. As a result, unused variables/functions will be eliminated, and the alias checkingalgorithm assumes that objects with static storage cannot be referenced from functions outside the currentmodule. During MIL linking not all uses of a variable/function can be known to the compiler. For examplewhen a variable is referenced in an assembly file or a (third-party) library. With the export attribute thecompiler will not per<strong>for</strong>m optimizations that affect the unknown code.int i __attribute__((export)); /* 'i' has external linkage */<strong>for</strong>mat(type,arg_string_index,arg_check_start)You can use __attribute__((<strong>for</strong>mat(type,arg_string_index,arg_check_start))) tospecify that functions take <strong>for</strong>mat strings as arguments and that calls to these functions must betype-checked against a <strong>for</strong>mat string, similar to the way the compiler checks calls to the functions printf,scanf, strftime, and strfmon <strong>for</strong> errors.arg_string_index is a constant integral expression that specifies which argument in the declaration of theuser function is the <strong>for</strong>mat string argument.arg_check_start is a constant integral expression that specifies the first argument to check against the<strong>for</strong>mat string. If there are no arguments to check against the <strong>for</strong>mat string (that is, diagnostics should onlybe per<strong>for</strong>med on the <strong>for</strong>mat string syntax and semantics), arg_check_start should have a value of 0. Forstrftime-style <strong>for</strong>mats, arg_check_start must be 0.Example:int foo(int i, const char * my_<strong>for</strong>mat, ...) __attribute__ ((<strong>for</strong>mat(printf, 2, 3)));The <strong>for</strong>mat string is the second argument of the function foo and the arguments to check start with thethird argument.flattenYou can use __attribute__((flatten)) to <strong>for</strong>ce inlining of all function calls in a function, includingnested function calls.Unless inlining is impossible or disabled by __attribute__((noinline)) <strong>for</strong> one of the calls, thegenerated code <strong>for</strong> the function will not contain any function calls.mallocYou can use __attribute__((malloc)) to improve optimization and error checking by telling thecompiler that:• The return value of a call to such a function points to a memory location or can be a null pointer.12

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

Saved successfully!

Ooh no, something went wrong!