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

Create successful ePaper yourself

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

<strong>TASKING</strong> <strong>VX</strong>-<strong>toolset</strong> <strong>for</strong> <strong>ARM</strong> <strong>User</strong> <strong>Guide</strong>This attribute is the same as #pragma protect/endprotect.pureYou can use __attribute__((pure)) to specify that a function has no side effects, although it mayread global data. Such pure functions can be subject to common subexpression elimination and loopoptimization.section("section_name")You can use __attribute__((section("name"))) to specify that a function must appear in theobject file in a particular section. For example:extern void foobar(void) __attribute__((section("bar")));puts the function foobar in the section named bar.See also #pragma section.usedYou can use __attribute__((used)) to prevent an unused symbol from being removed, by both thecompiler and the linker. Example:static const char copyright[] __attribute__((used)) = "Copyright 2010 Altium BV";When there is no C code referring to the copyright variable, the compiler will normally remove it. The__attribute__((used)) symbol attribute prevents this. Because the linker should also not removethis symbol, __attribute__((used)) implies __attribute__((protect)).unusedYou can use __attribute__((unused)) to specify that a variable or function is possibly unused. Thecompiler will not issue warning messages about unused variables or functions.weakYou can use __attribute__((weak)) to specify that the symbol resulting from the function declarationor variable must appear in the object file as a weak symbol, rather than a global one. This is primarilyuseful when you are writing library functions which can be overwritten in user code without causingduplicate name errors.See also #pragma weak.1.7. Pragmas to Control the CompilerPragmas are keywords in the C source that control the behavior of the compiler. Pragmas overrulecompiler options. Put pragmas in your C source where you want them to take effect. Unless stated14

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

Saved successfully!

Ooh no, something went wrong!