www.delorie.com/gnu/docs/gcc/cppinternals.html   search  
 
Buy the book!


The GNU C Preprocessor Internals

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Cpplib--the GNU C Preprocessor

The GNU C preprocessor in GCC 3.x has been completely rewritten. It is now implemented as a library, cpplib, so it can be easily shared between a stand-alone preprocessor, and a preprocessor integrated with the C, C++ and Objective-C front ends. It is also available for use by other programs, though this is not recommended as its exposed interface has not yet reached a point of reasonable stability.

The library has been written to be re-entrant, so that it can be used to preprocess many files simultaneously if necessary. It has also been written with the preprocessing token as the fundamental unit; the preprocessor in previous versions of GCC would operate on text strings as the fundamental unit.

This brief manual documents the internals of cpplib, and explains some of the tricky issues. It is intended that, along with the comments in the source code, a reasonably competent C programmer should be able to figure out what the code is doing, and why things have been implemented the way they have.

Conventions  Conventions used in the code.
The Lexer  The combined C, C++ and Objective-C Lexer.
Hash Nodes  All identifiers are entered into a hash table.
Macro Expansion Algorithm  Macro expansion algorithm.
Token Spacing  Spacing and paste avoidance issues.
Line numbering  Tracking location within files.
The Multiple-Include Optimization  Optimizing header files with guard macros.
File Handling  File handling.
Index  


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003