29.10.2014 Views

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

ARM Compiler toolchain v4.1 for µVision Using the Compiler

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>Compiler</strong> Features<br />

4.23 PreCompiled Header (PCH) file processing and <strong>the</strong> header stop point<br />

The PCH file contains a snapshot of all <strong>the</strong> code that precedes a header stop point. Typically,<br />

<strong>the</strong> header stop point is <strong>the</strong> first token in <strong>the</strong> primary source file that does not belong to a<br />

preprocessing directive. In <strong>the</strong> following example, <strong>the</strong> header stop point is int and <strong>the</strong> PCH file<br />

contains a snapshot that reflects <strong>the</strong> inclusion of xxx.h and yyy.h:<br />

#include "xxx.h"<br />

#include "yyy.h"<br />

int i;<br />

The header stop point can be manually specified with #pragma hdrstop. If used, this pragma must<br />

be placed be<strong>for</strong>e <strong>the</strong> first token that does not belong to a preprocessing directive. In this<br />

example, it must be placed be<strong>for</strong>e int, as follows:<br />

#include "xxx.h"<br />

#include "yyy.h"<br />

#pragma hdrstop<br />

int i;<br />

If a #if block encloses <strong>the</strong> first non-preprocessor token or #pragma hdrstop, <strong>the</strong> header stop point<br />

is <strong>the</strong> outermost enclosing #if. For example:<br />

#include "xxx.h"<br />

#ifndef YYY_H<br />

#define YYY_H 1<br />

#include "yyy.h"<br />

#endif<br />

#if TEST /* Header stop point lies immediately be<strong>for</strong>e #if TEST */<br />

int i;<br />

#endif<br />

In this example, <strong>the</strong> first token that does not belong to a preprocessing directive is int, but <strong>the</strong><br />

header stop point is <strong>the</strong> start of <strong>the</strong> #if block containing it. The PCH file reflects <strong>the</strong> inclusion<br />

of xxx.h and, conditionally, <strong>the</strong> definition of YYY_H and inclusion of yyy.h. It does not contain <strong>the</strong><br />

state produced by #if TEST.<br />

4.23.1 See also<br />

Tasks<br />

• Selectively applying PreCompiled Header (PCH) file processing on page 4-37<br />

• Selectively applying PreCompiled Header (PCH) file processing on page 4-37<br />

• Suppressing PreCompiled Header (PCH) file processing on page 4-38.<br />

Concepts<br />

• PreCompiled Header (PCH) files on page 4-29<br />

• Automatic PreCompiled Header (PCH) file processing on page 4-30<br />

• PreCompiled Header (PCH) file creation requirements on page 4-32<br />

• PreCompiled Header (PCH) file creation requirements on page 4-32<br />

• Per<strong>for</strong>mance issues with PreCompiled Header (PCH) files on page 4-40.<br />

Reference<br />

<strong>Compiler</strong> Reference:<br />

• #pragma hdrstop on page 5-52<br />

• --pch on page 3-75<br />

• --pch_dir=dir on page 3-75.<br />

<strong>ARM</strong> DUI 0375C Copyright © 2007-2008, 2011 <strong>ARM</strong>. All rights reserved. 4-31<br />

ID061811<br />

Non-Confidential

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

Saved successfully!

Ooh no, something went wrong!