comparison tradcpp.1 @ 110:b2f2f30194b8

Add a man page.
author David A. Holland
date Tue, 11 Jun 2013 13:10:43 -0400
parents
children 103acee239e0
comparison
equal deleted inserted replaced
109:4483a14ee101 110:b2f2f30194b8
1 .\"
2 .\" Copyright (c) 2013 The NetBSD Foundation, Inc.
3 .\" All rights reserved.
4 .\"
5 .\" This code is derived from software contributed to The NetBSD Foundation
6 .\" by David A. Holland.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 .\" POSSIBILITY OF SUCH DAMAGE.
28 .\"
29 .Dd June 11, 2013
30 .Dt TRADCPP 1
31 .Os
32 .Sh NAME
33 .Nm tradcpp
34 .Nd traditional (K&R-style) C macro preprocessor
35 .Sh SYNOPSIS
36 .Nm tradcpp
37 .Op Fl options
38 .Op Cm input-file Op Cm output-file
39 .Sh DESCRIPTION
40 The
41 .Nm
42 command provides a traditional K&R-style C macro preprocessor.
43 It is intended to be suitable for historical Unix uses of the
44 preprocessor, such as
45 .Xr imake 1 ,
46 particularly those that depend on preservation of whitespace.
47 .Pp
48 The chief ways in which traditional cpp differs from
49 Standard C are:
50 .Bl -bullet -offset indent
51 .It
52 Macro arguments are expanded within quoted strings.
53 There is no stringize operator.
54 .It
55 There is no token pasting operator; tokens can be concatenated by
56 placing comments between them.
57 This process is also not limited to valid C language tokens.
58 .It
59 Whitespace is preserved, and in particular tabs are not expanded into
60 spaces.
61 Furthermore, additional whitespace is not injected.
62 .El
63 .Sh OPTIONS
64 .Nm
65 has many options, many of which are defined for compatibility with
66 .Xr gcc 1
67 or other compilers.
68 Many of the options are not yet implemented.
69 .\" The option lists have been sorted in what I hope is a sensible
70 .\" order. Please don't arbirarily alphabetize them.
71 .Ss Common Options
72 .Bl -tag -width bubblebabble
73 .It Fl C
74 Retain comments in output.
75 .It Fl Dmacro[=expansion]
76 Provide a definition for the named macro.
77 If no expansion is provided, the value
78 .Dq 1
79 is used.
80 .It Fl -Ipath
81 Add the specified path to the main list of include directories.
82 .It Fl nostdinc
83 Do not search the standard system include directories.
84 .It Fl P
85 Suppress line number information in the output.
86 Currently line number information is not generated at all and this
87 option has no effect.
88 .It Fl Umacro
89 Remove any existing defintion for the named macro.
90 .It Fl undef
91 Remove all predefined macros.
92 .El
93 .Ss Warning Options
94 Warning options can be disabled or enabled by inserting, or not, the
95 string
96 .Dq no-
97 between the
98 .Dq W
99 and the warning name.
100 Herein the
101 .Dq Fl Wno-
102 form is shown for options that are enabled by default.
103 .Bl -tag -width bubblebabble
104 .It Fl Wall
105 Turn on all warnings.
106 The option
107 .Fl Wno-all
108 disables only the warnings that are disabled by default.
109 .It Fl w
110 Turn off all warnings.
111 .It Fl Werror
112 Make warnings into fatal errors.
113 .It Fl Wcomment
114 Warn about nested comments.
115 .It Fl Wno-endif-labels
116 Don't warn about symbols attached to #endif directives.
117 (The warning is currently not implemented.)
118 .It Fl Wundef
119 Warn about undefined symbols appearing in #if and #elif expressions.
120 .It Fl Wunused-macros
121 Warn about macros that are defined and never used.
122 Not implemented.
123 .El
124 .Ss Depend Options
125 .Bl -tag -width bubblebabble
126 .It Fl M
127 Generate dependency information for
128 .Xr make 1
129 on the standard output, instead of preprocessing.
130 Not implemented.
131 .It Fl MD
132 Like
133 .Fl M
134 but skip system headers.
135 Not implemented.
136 .It Fl MM
137 Like
138 .Fl M
139 but write the dependency information to a file named after the input
140 file with extension
141 .Pa \.d
142 and preprocess normally to standard output.
143 Not implemented.
144 .It Fl MMD
145 Like
146 .Fl MM
147 but skip system headers.
148 Not implemented.
149 .It Fl MG
150 When generating dependency information, assume that missing files are
151 generated instead of failing.
152 Not implemented.
153 .It Fl MP
154 Issue dummy rules for all include files.
155 This prevents
156 .Xr make 1
157 from choking if an include file is removed.
158 Not implemented.
159 .El
160 .Ss Diagnostic Options
161 .Bl -tag -width bubblebabble
162 .It Fl dD
163 Dump all macro definitions, except for the predefined macros, after
164 the normal preprocessing output.
165 Not implemented.
166 .It Fl dI
167 Dump all include directives along with the normal preprocessing
168 output.
169 Not implemented.
170 .It Fl dM
171 Dump all macro definitions instead of the normal preprocessing
172 output.
173 Not implemented.
174 .It Fl dN
175 Like
176 .Fl dD
177 but emits only macro names and not the expansions.
178 Not implemented.
179 .It Fl H
180 Output a trace of the include tree as it gets processed.
181 Not implemented.
182 .El
183 .Ss Other Options
184 .Bl -tag -width bubblebabble
185 .It Fl CC
186 Retain comments in output.
187 Same as
188 .Fl C ,
189 accepted for compatibility with
190 .Xr gcc 1 .
191 .It Fl fdollars-in-identifiers Fl fno-dollars-in-identifiers
192 Enable
193 .Pq or disable, respectively
194 the use of the dollar sign in identifiers.
195 Not implemented.
196 .It Fl ftabstop=num
197 Set the tab width to the specified value, for reporting column
198 positions in diagnostics.
199 The default is 8.
200 Not implemented.
201 .It Fl std=standard
202 Ask
203 .Nm
204 to conform to the named standard.
205 The default, and the only supported value, is
206 .Dq krc .
207 .It Fl traditional
208 This option is accepted for compatibility with
209 .Xr gcc 1
210 and ignored.
211 .El
212 .Sh FILES
213 The default list of directories searched for include files is:
214 .Bl -item -offset indent -compact
215 .It
216 .Pa /usr/local/include
217 .It
218 .Pa /usr/include
219 .El
220 .Sh SEE ALSO
221 .Xr cc 1 ,
222 .Xr cpp 1 ,
223 .Xr make 1
224 .Sh STANDARDS
225 None.
226 The whole point of a traditional cpp is that it reflects practices
227 in pre-standardization implementations of C.
228 Some information is available from the first edition of Kernighan and
229 Ritchie.
230 Much of the rest of the behavior is based on lore, pragmatism,
231 material encountered in the wild, and comparison to other
232 implementations.
233 .Sh HISTORY
234 The original version of
235 .Nm
236 was written one evening in late 2010.
237 This version had some problems and was put aside.
238 The first working version was released in June 2013.
239 .\" .Sh AUTHORS
240 .\" David A. Holland
241 .Sh BUGS
242 Probably plenty.