1CPP(1) BSD General Commands Manual CPP(1)
2
4 cpp — C preprocessor
5
7 cpp [-CdMtVv] [-D macro[=value]] [-I path] [-i file] [-S path] [-U macro]
8 [infile | -] [outfile]
9
11 The cpp utility is a macro preprocessor used by the pcc(1) compiler. It
12 is used to include header files, expand macro definitions, and perform
13 conditional compilation.
14
15 The infile input file is optional. If not provided or the file name is
16 "-" (dash), cpp reads its initial file from standard input. The outfile
17 output file is also optional. It writes by default to standard output.
18
19 The options are as follows:
20
21 -? Show command line usage for cpp.
22
23 -C Do not discard comments.
24
25 -D macro[=value]
26 Fake a definition at the beginning by using “#define
27 macro=value”. If value is not set on command-line, then define
28 it as 1.
29
30 -dM Print list of “#define” statements to standard output for all
31 defined macros other than builtin macros (see below). The normal
32 results of preprocessing are not output.
33
34 -I path
35 Add path to the list of directories containing needed header
36 files. This may be used to override system include directories
37 (see -S option). -I may be specified multiple times.
38
39 -i file
40 Include a file at the beginning by using “#include file”.
41
42 -M Generate dependencies for make(1).
43
44 -P Inhibit generation of line markers. This is sometimes useful
45 when running the preprocessor on something other than C code.
46
47 -S path
48 Add path to the list of system directories containing needed
49 header files. The -S option may be specified multiple times.
50 Note: cpp does not have a default include directory defined.
51
52 -t Traditional cpp syntax. Do not define the __TIME__, __DATE__,
53 __STDC__, and __STDC_VERSION__ macros.
54
55 -U macro
56 Undefine a macro at the beginning by using “#undef macro”.
57
58 -V Verbose debugging output. -V can be repeated for further
59 details.
60
61 -v Display version.
62
63 Builtin Macros
64 A few macros are interpreted inside the cpp program:
65
66 __DATE__ Expands to the date in abbreviated month, day, and year format
67 from ctime(3) in quotes.
68
69 __FILE__ Expands to the name of the current input file in quotes. When
70 read from standard input, it expands to "⟨stdin⟩".
71
72 __LINE__ Expands to the line number of the current line containing the
73 macro.
74
75 __STDC__ Expands to the constant 1. This means the compiler conforms to
76 ISO/IEC 9899:1990 (“ISO C90”) (also known as “C90”).
77
78 __STDC_VERSION__ Expands to “199901L” which indicates that cpp supports
79 ISO/IEC 9899:1999 (“ISO C99”) (commonly referred to as “C99”).
80
81 __TIME__ Expands to the time in hour, minutes, and seconds from ctime(3)
82 in quotes.
83
84 Also see the -t option.
85
87 The cpp utility exits with one of the following values:
88
89 0 Successfully finished.
90
91 1 An error occurred.
92
94 as(1), ccom(1), pcc(1)
95
97 The cpp command comes from the original Portable C Compiler by S. C.
98 Johnson, written in the late 70's. The code originates from the V6 pre‐
99 processor with some additions from V7 cpp and ansi/c99 support.
100
101 A lot of the PCC code was rewritten by Anders Magnusson.
102
103 This product includes software developed or owned by Caldera Interna‐
104 tional, Inc.
105
106BSD September 17, 2007 BSD