man cpp-2.95 (Commandes) - The GNU C-Compatible Compiler Preprocessor.

NAME

cccp, cpp - The GNU C-Compatible Compiler Preprocessor.

SYNOPSIS

cccp
[-$] [-Ac predicatec [(c valuec )]] [-C] [-Dc namec [=c definitionc ]] [-dD] [-dM] [-I c directoryc ] [-H] [-I-] [-imacros c filec ] [-include c filec ] [-idirafter c dirc ] [-iprefix c prefixc ] [-iwithprefix c dirc ] [-lang-c] [-lang-c++] [-lang-objc] [-lang-objc++] [-lint] [-M [-MG]] [-MM [-MG]] [-MD c file c ] [-MMD c file c ] [-nostdinc] [-nostdinc++] [-P] [-pedantic] [-pedantic-errors] [-traditional] [-trigraphs] [-Uc namec ] [-undef] [-Wtrigraphs] [-Wcomment] [-Wall] [-Wtraditional]

[c infilec |-] [c outfilec |-]

DESCRIPTION

The C preprocessor is a c macro processorc that is used automatically by the C compiler to transform your program before actual compilation. It is called a macro processor because it allows you to define c macrosc , which are brief abbreviations for longer constructs.

The C preprocessor provides four separate facilities that you can use as you see fit:

•
Inclusion of header files. These are files of declarations that can be substituted into your program.
•
Macro expansion. You can define c macrosc , which are abbreviations for arbitrary fragments of C code, and then the C preprocessor will replace the macros with their definitions throughout the program.
•
Conditional compilation. Using special preprocessing directives, you can include or exclude parts of the program according to various conditions.
•
Line control. If you use a program to combine or rearrange source files into an intermediate file which is then compiled, you can use line control to inform the compiler of where each source line originally came from.

C preprocessors vary in some details. For a full explanation of the GNU C preprocessor, see the info file `c cpp.infoc ', or the manual The C Preprocessorc . Both of these are built from the same documentation source file, `c cpp.texinfoc '. The GNU C preprocessor provides a superset of the features of ANSI Standard C.

ANSI Standard C requires the rejection of many harmless constructs commonly used by today's C programs. Such incompatibility would be inconvenient for users, so the GNU C preprocessor is configured to accept these constructs by default. Strictly speaking, to get ANSI Standard C, you must use the options `c -trigraphsc ', `c -undefc ' and `c -pedanticc ', but in practice the consequences of having strict ANSI Standard C make it undesirable to do this.

Most often when you use the C preprocessor you will not have to invoke it explicitly: the C compiler will do so automatically. However, the preprocessor is sometimes useful individually.

When you call the preprocessor individually, either name (c cppc or c cccpc ) will do-they are completely synonymous.

The C preprocessor expects two file names as arguments, c infilec and c outfilec . The preprocessor reads c infilec together with any other files it specifies with `c #includec '. All the output generated by the combined input files is written in c outfilec .

Either c infilec or c outfilec may be `c -c ', which as c infilec means to read from standard input and as c outfilec means to write to standard output. Also, if c outfilec or both file names are omitted, the standard output and standard input are used for the omitted file names.

OPTIONS

Here is a table of command options accepted by the C preprocessor. These options can also be given when compiling a C program; they are passed along automatically to the preprocessor when it is invoked by the compiler.

-P
Inhibit generation of `c #c '-lines with line-number information in the output from the preprocessor. This might be useful when running the preprocessor on something that is not C code and will be sent to a program which might be confused by the `c #c '-lines.
-C
Do not discard comments: pass them through to the output file. Comments appearing in arguments of a macro call will be copied to the output before the expansion of the macro call.
-traditional
Try to imitate the behavior of old-fashioned C, as opposed to ANSI C.
-trigraphs
Process ANSI standard trigraph sequences. These are three-character sequences, all starting with `c ??c ', that are defined by ANSI C to stand for single characters. For example, `c ??/c ' stands for `c \', so `c '??/n'c ' is a character constant for a newline. Strictly speaking, the GNU C preprocessor does not support all programs in ANSI Standard C unless `c -trigraphsc ' is used, but if you ever notice the difference it will be with relief.

You don't want to know any more about trigraphs.

-pedantic
Issue warnings required by the ANSI C standard in certain cases such as when text other than a comment follows `c #elsec ' or `c #endifc '.
-pedantic-errors
Like `c -pedanticc ', except that errors are produced rather than warnings.
-Wtrigraphs
Warn if any trigraphs are encountered (assuming they are enabled).
-Wcomment
-Wcomments
Warn whenever a comment-start sequence `c /*c ' appears in a comment. (Both forms have the same effect).
-Wall
Requests both `c -Wtrigraphsc ' and `c -Wcommentc ' (but not `c -Wtraditionalc ').
-Wtraditional
Warn about certain constructs that behave differently in traditional and ANSI C.
-I directoryc
Add the directory c directoryc to the end of the list of directories to be searched for header files. This can be used to override a system header file, substituting your own version, since these directories are searched before the system header file directories. If you use more than one `c -Ic ' option, the directories are scanned in left-to-right order; the standard system directories come after.
-I-
Any directories specified with `c -Ic ' options before the `c -I-c ' option are searched only for the case of `c #include "c filec "c '; they are not searched for `c #include <c filec >c '.

If additional directories are specified with `c -Ic ' options after the `c -I-c ', these directories are searched for all `c #includec ' directives.

In addition, the `c -I-c ' option inhibits the use of the current directory as the first search directory for `c #include "c filec "c '. Therefore, the current directory is searched only if it is requested explicitly with `c -I.c '. Specifying both `c -I-c ' and `c -I.c ' allows you to control precisely which directories are searched before the current one and which are searched after.

-nostdinc
Do not search the standard system directories for header files. Only the directories you have specified with `c -Ic ' options (and the current directory, if appropriate) are searched.
-nostdinc++
Do not search for header files in the C++ specific standard directories, but do still search the other standard directories. (This option is used when building libg++.)
-D namec
Predefine c namec as a macro, with definition `c 1c '.
-D name=definition
Predefine c namec as a macro, with definition c definitionc . There are no restrictions on the contents of c definitionc , but if you are invoking the preprocessor from a shell or shell-like program you may need to use the shell's quoting syntax to protect characters such as spaces that have a meaning in the shell syntax. If you use more than one `c -Dc ' for the same namec , the rightmost definition takes effect.
-U namec
Do not predefine c namec . If both `c -Uc ' and `c -Dc ' are specified for one name, the `c -Uc ' beats the `c -Dc ' and the name is not predefined.
-undef
Do not predefine any nonstandard macros.
-A name(value)
Assert (in the same way as the c #assertc directive) the predicate c namec with tokenlist c valuec . Remember to escape or quote the parentheses on shell command lines.

You can use `c -A-c ' to disable all predefined assertions; it also undefines all predefined macros.

-dM
Instead of outputting the result of preprocessing, output a list of `c #definec ' directives for all the macros defined during the execution of the preprocessor, including predefined macros. This gives you a way of finding out what is predefined in your version of the preprocessor; assuming you have no file `c foo.hc ', the command

touch foo.h; cpp -dM foo.h

will show the values of any predefined macros.
-dD
Like `c -dMc ' except in two respects: it does c notc include the predefined macros, and it outputs c bothc the `c #definec ' directives and the result of preprocessing. Both kinds of output go to the standard output file.

-M [-MG]
Instead of outputting the result of preprocessing, output a rule suitable for c makec describing the dependencies of the main source file. The preprocessor outputs one c makec rule containing the object file name for that source file, a colon, and the names of all the included files. If there are many included files then the rule is split into several lines using `c \\c '-newline.

`c -MGc ' says to treat missing header files as generated files and assume c they live in the same directory as the source file. It must be specified c in addition to `c -Mc '.

This feature is used in automatic updating of makefiles.

-MM [-MG]
Like `c -Mc ' but mention only the files included with `c #include "c filec "c '. System header files included with `c #include <c filec >c ' are omitted.
-MD file
Like `c -Mc ' but the dependency information is written to `c filec '. This is in addition to compiling the file as specified-`c -MDc ' does not inhibit ordinary compilation the way `c -Mc ' does.

When invoking gcc, do not specify the `c filec ' argument. Gcc will create file names made by replacing `c .cc ' with `c .dc ' at the end of the input file names.

In Mach, you can use the utility c mdc to merge multiple files into a single dependency file suitable for using with the `c makec ' command.

-MMD file
Like `c -MDc ' except mention only user header files, not system header files.
-H
Print the name of each header file used, in addition to other normal activities.
-imacros filec
Process c filec as input, discarding the resulting output, before processing the regular input file. Because the output generated from c filec is discarded, the only effect of `c -imacros c filec c ' is to make the macros defined in c filec available for use in the main input. The preprocessor evaluates any `c -Dc ' and `c -Uc ' options on the command line before processing `c -imacros c filec ' c .
-include file
Process file as input, and include all the resulting output, before processing the regular input file.
-idirafter dirc
Add the directory c dirc to the second include path. The directories on the second include path are searched when a header file is not found in any of the directories in the main include path (the one that `c -Ic ' adds to).
-iprefix prefixc
Specify c prefixc as the prefix for subsequent `c -iwithprefixc ' options.
-iwithprefix dirc
Add a directory to the second include path. The directory's name is made by concatenating c prefixc and c dirc , where c prefixc was specified previously with `c -iprefixc '.
-lang-c
-lang-c++
-lang-objc
-lang-objc++
Specify the source language. `c -lang-c++c ' makes the preprocessor handle C++ comment syntax, and includes extra default include directories for C++, and `c -lang-objcc ' enables the Objective C `c #importc ' directive. `c -lang-cc ' explicitly turns off both of these extensions, and `c -lang-objc++c ' enables both.

These options are generated by the compiler driver c gccc , but not passed from the `c gccc ' command line.

-lint
Look for commands to the program checker c lintc embedded in comments, and emit them preceded by `c #pragma lintc '. For example, the comment `c /* NOTREACHED */c ' becomes `c #pragma lint NOTREACHEDc '.

This option is available only when you call c cppc directly; c gccc will not pass it from its command line.

-$
Forbid the use of `c $c ' in identifiers. This was formerly required for strict conformance to the C Standard before the standard was corrected. c

This option is available only when you call c cppc directly; gccc will not pass it from its command line.

SEE ALSO

`Cpp' entry in infoc ; The C Preprocessorc , Richard M. Stallman.

gcc(1); `Gcc' entry in infoc ; Using and Porting GNU CC (for version 2.0)c , Richard M. Stallman.

COPYING

Copyright (c) 1991, 1992, 1993 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English.