cpp.1
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 1 代码 · 共 321 行
1
321 行
.TH cpp 1 RISC.SH Namecpp \- the C language preprocessor.SH Syntax.NXR "cpp command".B /lib/cpp [.I option ....B ].B [.I ifile.B [.I ofile.B ] ].SH DescriptionThe.PN cpp\^commandis the C language preprocessor which is invoked as thefirst pass of any C compilation using the.MS cc 1command. Thus, the output of.PN cpp\^is designed to be in a form acceptable as inputto the next pass of the C compiler..PPThe preferred way to invoke.PN cpp\^ ,however, is through the.MS cc 1command. See.MS m4 1for a general macro processor..SH ArgumentsThe.PN cpp\^command optionally accepts two file names as arguments.The.I ifile\^and.I ofile\^ are, respectively, the input and outputfor the preprocessor. They default to standard inputand standard output if no argument is supplied..SH Options.TP 20.B \-BStrips C++-style comments (begin with \fB//\fP and end with newline)..TP.B \-CPasses along all comments, except those found on.PN cppdirective lines.By default,.PN cpp\^strips C-style comments. .TP.B \-MGenerates dependency lists suitable for use with.MS make 1instead of the normal output..TP.B \-PPreprocesses the input without producing the line controlinformation used by the next pass of the C compiler..TP.B \-RPermits recursion when a macro is expanded..TP.BI \-U nameRemoves any initial definition of.IR name ,where.I name\^is a reserved symbolthat is predefined by the preprocessor.The symbols predefined by this implementation are bsd4_2, ultrix, unix,mips, host_mips, and MIPSEL..PD.TP.BI \-D name.PD 0.TP.BI \-D name=defDefines.I name\^as if by a.B #definedirective. If no.I =def\^is given,.I name\^is defined as 1.The.B \-Doption has lower precedence than the.B \-Uoption.That is, if the same name is used in both a.B \-Uoption and a.B \-Doption, the name remains undefined regardless of the order of the options..PD.TP.BI \-I dirChanges the algorithm for searching for .B #includefileswhose names do not begin with a slash ( \fB/\fP )to look in.I dir\^before looking in the directories on the standard list.Thus, .B #includefiles whose names are enclosed in quotes ( \fB"\|"\fP )will be searched forfirst in the directory of thefile with the.B #includeline,then in directories named in .B \-Ioptions,and, finally, in directories on a standard list.For.B #includefiles whose names are enclosed in angle brackets.BR ( <> ),the directory of thefile with the.B #includeline is not searched..SH Directives.PPAll.PN cpp\^directives start with lines that begin with a pound sign.BR ( # ).Any number of blanks and tabs are allowed between thepound signsand the directive.The following is a list of the directives:.TP 20\fB#define \fIname\fB(\fIarg\fB, ...,\fIarg\fB )\fI token-string\fRReplaces subsequent instances of.I nameand the following set of tokens that is enclosed in parenthesesby.IR token-string .Each occurrence of an.I argin the.I token-stringis replaced by the corresponding set of tokens in the comma-separated list.Note that spaces between.I nameand the left parenthesis.BR ( ( )are not allowed.When a macro with arguments is expanded, the arguments are placed unchanged into the expanded.I token-string .After the entire.I token-stringhas been expanded,.PN cppre-starts its scan for names to expand at the beginning of the newlycreated.IR token-string ..TP.BI #undef " name"Causes the definition of.I name(if any) to be forgotten..TP\fB#include\fI "filename".PD 0.TP.BI #include " " < filename >Includes the contents of.I filename ,which will then be run through.PN cpp .When the.BI < filename >notation is used,.I filenameis searched for in the standard places.See the.B \-Ioption above for more detail..PD.TP\fB#line\fI integer-constant "filename"Causes.PN cppto generate line control information for the next pass of theC compiler..I Integer-constantis the line number of the next lineand.I filenameis the file that it comes from.If \fI"filename"\fR is not given, the current file name is unchanged..TP.B #endif.brEnds a section of lines begun by a test directive.RB ( #if ,.BR #ifdef ,or.BR #ifndef ).Each test directive must have a matching.BR #endif ..TP.BI #ifdef " name"Defines text that will appear in the output if .I namehas been the subject of a previous.B #definewithout being the subject of an intervening.BR #undef ..TP.BI #ifndef " name"Defines text that will not appear in the output if .I namehas been the subject of a previous.B #definewithout being the subject of an intervening.BR #undef ..TP.BI #if " constant-expression"Defines text that will appear in the output if .I constant-expression is not zero.All binary non-assignment C operators, which include the.B ?: ,en dash.BR (\(mi ) ,exclamation mark.BR (!) ,and tilde.B (~)are legal in.IR constant-expression .The precedence of the operators is the same as defined by the C language.There is also a unary operator.BR defined ,which can be used in.I constant-expressionin these two forms:.BI defined " " ( " name " )or.BI defined " name" .This allows the utility of.BR #ifdef " and " #ifndefin a.B #ifdirective.Only these operators, integer constants, and names whichare known by.PN cppshould be used in.IR constant-expression .In particular, the.B sizeofoperator is not available..TP.B #elseReverses the notion of the test directive whichmatches this directive. So if lines prior tothis directive are ignored, the following lineswill appear in the output.The reverse is also true..TP.BI #elif " constant-expression"Defines text that will appear in the output if the precedingtest directive and all intervening.B #elifdirectives equalled zero and the.I constant-expressiondid not equal zero.The rules for.I constant-expressionare the same as for the.B #ifdirective..PPThe test directives and the possible.B #elseand.B #elifdirectives can be nested..PPIn addition to these directives, the System V.B #identdirective is recognized and ignored..PPTwo special names are understood by.PN cpp :.B _\^\^_\s-1LINE\s+1_\^\^_is defined as the current line number (as a decimal integer) and.B _\^\^_\s-1FILE\s+1_\^\^_is defined as the current file name (as a C string).They can be used in any situations where you would useother defined names, including in macros..SH DiagnosticsThe error messages produced by.PN cpp\^are self-explanatory. The line number and filenamewhere the error occurred are printed along with the diagnostic..SH Files.TP 1.5i/usr/includestandard directory for.B #includefiles.SH See Alsocc(1), m4(1)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?