|CPP(1)||General Commands Manual||CPP(1)|
cpputility is a macro preprocessor used by the pcc(1) compiler. It is mainly used to include header files, expand macro definitions, discard comments, and perform conditional compilation.
cppis written to comply with the ISO/IEC 9899:1999 (“ISO C99”) specification.
The infile input file is optional. If not
provided or the file name is “-” (dash),
cpp reads its initial file from standard input. The
outfile output file is also optional, with output
written to standard output if not provided.
The options are as follows:
- For assembler-with-cpp input: treat non-directive lines starting with a # as comments.
- Do not discard comments.
- Create a macro definition before processing any input, as if a
#define macro value
directive had appeared in the source. If value is not set on the command-line, then a value of 1 is used.
- Modify output according to flags, which can be a
list of character flags. The following flags are currently supported:
- Do not process any input, but output a list of “#define” statements for all defined macros other than builtin macros (see below).
any unknown flags are ignored.
- Modify the exit code, if there were any warnings.
- Add path to the list of directories searched by the
“#include” directive. This may be used to override system
include directories (see
-Imay be specified multiple times and is cumulative.
- Include a file before processing any input, as if a
directive had appeared in the source.
-imay be specified multiple times to include several files.
- Instead of producing a processed C code file, output a list of dependencies for make(1), detailing the files that need to be processed when compiling the input.
- Inhibit generation of line markers. This is sometimes useful when running the preprocessor on something other than C code.
- Add path to the list of system directories searched
by the “#include” directive. The
-Soption may be specified multiple times and is cumulative.
- Traditional cpp syntax. Do not define the
- Undefine a macro before processing any input, as if a
directive had appeared in the source.
- Verbose debugging output.
-Vcan be repeated for greater detail. (This is only available if the
cppprogram was built with
PCC_DEBUGdefined, which is the default).
- Display version.
-U options are processed in the order that they
appear on the command line, before any input is read but after the command
line options have been scanned.
Files referenced by the “#include” directive as
“...”, are first looked for in the current directory, then as
per ⟨...⟩ files, which are first looked for in the list of
directories provided by any
-I options, then in the
list of system directories provided by any
options. Note that
cpp does not define any include
directories by default; if no
-S options are given, then only the current
directory will be searched and no system files will be found.
Builtin Macros¶A few macros are interpreted inside the
- Expands to a quoted string literal containing the date in the form “Mmm dd yyyy”, where the names of the months are the same as those generated by the asctime(3) function, and the first character of dd is a space character if the value is less than 10.
- Expands to a quoted string literal containing the presumed name of the current source file. When reading source from standard input, it expands to “⟨stdin⟩”.
- Expands to an integer constant representing the presumed line number of the source line containing the macro.
- Expands to the integer constant “1”, meaning that the compiler conforms to ISO/IEC 9899:1990 (“ISO C90”).
- Expands to the integer constant “199901L”, indicating that
cppconforms to ISO/IEC 9899:1999 (“ISO C99”).
- Expands to a quoted string literal containing the time in the form “hh:mm:ss” as generated by the asctime(3) function.
Also see the
cpputility exits with one of the following values:
- Successfully finished.
- An error occurred.
-Eoption was given, and warnings were issued.
SEE ALSO¶as(1), ccom(1), make(1), pcc(1), asctime(3)
cppcommand comes from the original Portable C Compiler by S. C. Johnson, written in the late 70's. The code originates from the V6 preprocessor with some additions from V7 cpp and ansi/c99 support.
A lot of the PCC code was rewritten by Anders Magnusson.
This product includes software developed or owned by Caldera International, Inc.
|February 26, 2013||Linux 4.19.0-6-amd64|