cpp-4.8
Preprocess C and C++ source code
SYNOPSIS
cpp-4.8 [options] input-file
PARAMETERS
-D name[=definition]
Define macro name with optional definition.
-U name
Undefine macro name.
-I dir
Add directory dir to the list of header file search paths.
-M
Generate makefile dependency rules.
-MM
Like -M but omit system header files.
-MF file
Write dependency output to file.
-E
Preprocess only; do not compile, assemble or link.
-P
Inhibit generation of line markers in the output from the preprocessor.
-C
Do not discard comments.
-CC
Do not discard comments, including during macro expansion.
-dM
Output macro definitions only.
-Wall
Enable most warning messages.
DESCRIPTION
The cpp-4.8 command is a specific version of the GNU C Preprocessor (CPP). The C preprocessor is a separate program invoked by the C compiler to perform initial transformations on source code before actual compilation. These transformations include macro substitution, conditional compilation, and file inclusion. cpp-4.8 version is crucial for building software that depends on a particular version of the preprocessor's behavior or features. Understanding the options and behavior of cpp-4.8 allows developers to precisely control the pre-processing stage, which is essential for code maintainability, portability, and optimization. Common uses involve managing platform-specific code sections, including header files, and implementing complex macro definitions. The output of cpp-4.8 is often then fed to the C compiler itself for further compilation and linking.
CAVEATS
The cpp-4.8 command's availability depends on the presence and proper installation of the GCC 4.8 compiler suite. The exact behavior may vary slightly based on the specific GCC 4.8 build and the target architecture.
STANDARD USAGE
cpp-4.8 is primarily used as a backend tool invoked by compilers like gcc. However, it can be invoked independently for tasks like analyzing macro expansions or generating header files. For example
`cpp-4.8 -E input.c > output.i`
would preprocess `input.c` and write the result to `output.i`.
DEPENDENCY GENERATION
The `-M` and `-MM` options are crucial for automating build processes using tools like make. They allow developers to automatically track header file dependencies, ensuring that code is recompiled only when necessary. By using `cpp-4.8 -MM -MF dependencies.mk input.c`, make can automatically rebuild the code based on the tracked dependencies.
HISTORY
The GNU C Preprocessor (CPP) has evolved along with the GNU Compiler Collection (GCC). The cpp-4.8 command specifically refers to the version of CPP included with GCC 4.8. This version was widely used in the early to mid 2010s and represents a stable point in the preprocessor's development. Before this, the preprocessor was tightly integrated into the C compiler itself. Its separation allowed for it to be used by other languages, which helped in standardization efforts and improved code reusability. Since then the gnu c preprocessor evolved with newer versions of GCC.