Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
cpp-2.95(1)
Edit
PageHistory
Diff
Info
LikePages
cpp !!!cpp NAME SYNOPSIS DESCRIPTION OPTIONS SEE ALSO COPYING ---- !!NAME cccp, cpp - The GNU C-Compatible Compiler Preprocessor. !!SYNOPSIS __cccp__ [[__-$__] [[__-A__''predicate''[[__(__''value''__)__]] [[__-C__] [[__-D__''name''[[__=__''definition'']] [[__-dD__] [[__-dM__] [[__-I__ ''directory''] [[__-H__] [[__-I-__] [[__-imacros__ ''file''] [[__-include__ ''file''] [[__-idirafter__ ''dir''] [[__-iprefix__ ''prefix''] [[__-iwithprefix__ ''dir''] [[__-lang-c__] [[__-lang-c++__] [[__-lang-objc__] [[__-lang-objc++__] [[__-lint__] [[__-M__ [[__-MG__]] [[__-MM__ [[__-MG__]] [[__-MD__ ''file'' ] [[__-MMD__ ''file'' ] [[__-nostdinc__] [[__-nostdinc++__] [[__-P__] [[__-pedantic__] [[__-pedantic-errors__] [[__-traditional__] [[__-trigraphs__] [[__-U__''name''] [[__-undef__] [[__-Wtrigraphs__] [[__-Wcomment__] [[__-Wall__] [[__-Wtraditional__] [[''infile''|__-__] [[''outfile''|__-__] !!DESCRIPTION The C preprocessor is a ''macro processor'' that is used auto- matically by the C compiler to transform your program be- fore actual compilation. It is called a macro processor because it allows you to define ''macros'', 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 dec- larations that can be substituted into your pro- gram. Macro expansion. You can define ''macros'', 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 preprocess- ing 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 orig- inally came from. C preprocessors vary in some details. For a full explana- tion of the GNU C preprocessor, see the __info__ file `__cpp.in- fo__', or the manual ''The C Preprocessor''. Both of these are built from the same documentation source file, `__cpp.texin- fo__'. 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 in- compatibility 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 `__-trigraphs__', `__-undef__' and `__-pedan- tic__', 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 (__cpp__ or __cccp__) will do--they are completely synonymous. The C preprocessor expects two file names as arguments, ''infile'' and ''outfile''. The preprocessor reads ''infile'' togeth- er with any other files it specifies with `__#include__'. All the output generated by the combined input files is writ- ten in ''outfile''. Either ''infile'' or ''outfile'' may be `__-__', which as ''infile'' means to read from standard input and as ''outfile'' means to write to standard output. Also, if ''outfile'' 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 pre- processor. 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 `__#__'-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 `__#__'-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 `__??__', that are defined by ANSI C to stand for sin- gle characters. For example, `__??/__' stands for `__\__', so `__'??/n'__' is a character constant for a newline. Strictly speaking, the GNU C preprocessor does not support all programs in ANSI Standard C unless `__-trigraphs__' 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 com- ment follows `__#else__' or `__#endif__'. __-pedantic-errors__ Like `__-pedantic__', 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 `__/*__' appears in a comment. (Both forms have the same effect). __-Wall__ Requests both `__-Wtrigraphs__' and `__-Wcomment__' (but not `__-Wtraditional__'). __-Wtraditional__ Warn about certain constructs that behave differ- ently in traditional and ANSI C. __-I__ ''directory'' Add the directory ''directory'' 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 directo- ries are searched before the system header file di- rectories. If you use more than one `__-I__' option, the directories are scanned in left-to-right order; the standard system directories come after. __-I-__ Any directories specified with `__-I__' options before the `__-I-__' option are searched only for the case of `__#include__ ''file'' ''#in- clude ''''file'''' If additional directories are specified with `__-I__' options after the `__-I-__', these directories are searched for all `__#include__' directives. In addition, the `__-I-__' option inhibits the use of the current directory as the first search directory for `__#include__ ''file'' ''-I.__'. Specifying both `__-I-__' and `__-I.__' 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 speci- fied with `__-I__' 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__ ''name'' Predefine ''name'' as a macro, with definition `__1__'. __-D__ ''name''__=__''definition'' Predefine ''name'' as a macro, with definition ''defini- tion''. There are no restrictions on the contents of ''definition'', but if you are invoking the preproces- sor from a shell or shell-like program you may need to use the shell's quoting syntax to protect char- acters such as spaces that have a meaning in the shell syntax. If you use more than one `__-D__' for the same ''name'', the rightmost definition takes ef- fect. __-U__ ''name'' Do not predefine ''name''. If both `__-U__' and `__-D__' are specified for one name, the `__-U__' beats the `__-D__' and the name is not predefined. __-undef__ Do not predefine any nonstandard macros. __-A__ ''name(''__value__'')'' Assert (in the same way as the __#assert__ directive) the predicate ''name'' with tokenlist ''value''. Remember to escape or quote the parentheses on shell command lines. You can use `__-A-__' to disable all predefined asser- tions; it also undefines all predefined macros. __-dM__ Instead of outputting the result of preprocessing, output a list of `__#define__' directives for all the macros defined during the execution of the prepro- cessor, 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 `__foo.h__', the command touch foo.h; cpp -dM foo.h will show the values of any predefined macros. __-dD__ Like `__-dM__' except in two respects: it does ''not'' in- clude the predefined macros, and it outputs ''both'' the `__#define__' directives and the result of prepro- cessing. Both kinds of output go to the standard output file. __-M__ [[__-MG__] Instead of outputting the result of preprocessing, output a rule suitable for __make__ describing the de- pendencies of the main source file. The preproces- sor outputs one __make__ 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 `__\__'-newline. `__-MG__' says to treat missing header files as gener- ated files and assume they live in the same direc- tory as the source file. It must be specified in addition to `__-M__'. This feature is used in automatic updating of make- files. __-MM__ [[__-MG__] Like `__-M__' but mention only the files included with `__#include__ __file'' ''#include__ __file'' '' __-MD__ ''file'' Like `__-M__' but the dependency information is written to `''file'''. This is in addition to compiling the file as specified--`__-MD__' does not inhibit ordinary compilation the way `__-M__' does. When invoking gcc, do not specify the `''file''' argu- ment. Gcc will create file names made by replacing `__.c__' with `__.d__' at the end of the input file names. In Mach, you can use the utility __md__ to merge multi- ple files into a single dependency file suitable for using with the `__make__' command. __-MMD__ ''file'' Like `__-MD__' except mention only user header files, not system header files. __-H__ Print the name of each header file used, in addi- tion to other normal activities. __-imacros__ ''file'' Process ''file'' as input, discarding the resulting output, before processing the regular input file. Because the output generated from ''file'' is discard- ed, the only effect of `__-imacros__ ''file''' is to make the macros defined in ''file'' available for use in the main input. The preprocessor evaluates any `__-D__' and `__-U__' options on the command line before pro- cessing `__-imacros__ ''file''' . __-include__ ''file'' Process ''file'' as input, and include all the result- ing output, before processing the regular input file. __-idirafter__ ''dir'' Add the directory ''dir'' 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 `__-I__' adds to). __-iprefix__ ''prefix'' Specify ''prefix'' as the prefix for subsequent `__-iwithprefix__' options. __-iwithprefix__ ''dir'' Add a directory to the second include path. The directory's name is made by concatenating ''prefix'' and ''dir'', where ''prefix'' was specified previously with `__-iprefix__'. __-lang-c__ __-lang-c++__ __-lang-objc__ __-lang-objc++__ Specify the source language. `__-lang-c++__' makes the preprocessor handle C++ comment syntax, and in- cludes extra default include directories for C++, and `__-lang-objc__' enables the Objective C `__#import__' directive. `__-lang-c__' explicitly turns off both of these extensions, and `__-lang-objc++__' enables both. These options are generated by the compiler driver __gcc__, but not passed from the `__gcc__' command line. __-lint__ Look for commands to the program checker __lint__ em- bedded in comments, and emit them preceded by `__#pragma lint__'. For example, the comment `__/* NOTREACHED */__' becomes `__#pragma lint__ NOTREACHED'. This option is available only when you call __cpp__ di- rectly; __gcc__ will not pass it from its command line. __-$__ Forbid the use of `__$__' in identifiers. This was formerly required for strict conformance to the C Standard before the standard was corrected. This option is available only when you call __cpp__ direct- ly; __gcc__ will not pass it from its command line. !!SEE ALSO `__Cpp__' entry in __info__; ''The C Preprocessor'', Richard M. Stall- man.__ gcc__(__1__); `__Gcc__' entry in __info__; ''Using and Porting GNU CC (for version 2.0)'', 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 ver- sions 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 con- ditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original En- glish. ----
One page links to
cpp-2.95(1)
:
Man1c
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.