2.5. cpp, the GNU Preprocessor
cpp is a C-compatible macro preprocessor
that works with the GNU compiler to direct the parsing of
C preprocessor directives.
Preprocessing directives are the lines in your program
that start with a # directive name (a #
sign followed by an identifier).
For instance, cpp merges #include files,
expands macro definitions, and processes #ifdef
Another example is #define,
a directive that defines a macro (#define
must be followed by a macro name and the macro's intended expansion).
To refer to the output of cpp, invoke gcc
with the -E option;
the preprocessed file will print on stdout
The C preprocessor provides the following separate facilities:
Inclusion of header files —
Declarations that can be substituted into your program.
When defining macros,
which are abbreviations for arbitrary fragments of C code,
the C preprocessor replaces them with their definitions throughout a program.
Conditional compilation —
Using special preprocessing directives,
include or exclude parts of a program according to replaceableious conditions.
Line control —
Using a program to combine or rearrange source files into an intermediate file that
is then compiled,
use line control to provide a source line's origin.
There are two convenient options to assemble files that require C-style preprocessing.
Both options depend on using the compiler driver program,
instead of directly calling the assembler.
Name the source file using the extension .S
(capitalized), rather than .s
indicates an assembly language program that requires C-style preprocessing).
Specify a source language explicitly for a situation,
using the -xassembler-with-cpp
For more information on cpp,
Using cpp, the C Preprocessor.