Document -std=c90 in the manpage.
[cparser] / cparser.1
1 .\" Please adjust this date whenever revising the manpage.
2 .Dd July 3, 2012
3 .Dt CPARSER 1
4 .Sh NAME
5 .Nm cparser
6 .Nd C compiler
7 .Sh SYNOPSIS
8 .Nm
9 .Op Fl c | S | E | -print-ast
10 .Op Fl -print-implicit-cast
11 .Op Fl -print-parenthesis
12 .Op Fl std= Ns Ar standard
13 .Op Fl - Ns Oo Cm no- Oc Ns Cm gcc
14 .Op Fl - Ns Oo Cm no- Oc Ns Cm ms
15 .Op Fl g
16 .Op Fl O Ns Ar level
17 .Op Fl W Ns Oo Cm no- Oc Ns Oo Cm error= Oc Ns Ar warning
18 .Op Fl w
19 .Op Fl I Ar dir
20 .Op Fl L Ar dir
21 .Op Fl D Ns Ar macro Ns Op Ar =defn
22 .Op Fl U Ns Ar macro
23 .Op Fl f Ar option
24 .Op Fl finput-charset= Ns Ar encoding
25 .Op Fl b Ar option
26 .Op Fl l Ar library
27 .Op Fl o Ar outfile
28 .Op Fl x Ar language
29 .Op Fl Wl, Ns Ar option
30 .Op Fl Wp, Ns Ar option
31 .Ar
32 .Sh DESCRIPTION
33 .Nm
34 is a C compiler, which can parse C90 and C99 as well as many GCC and some MSC extensions.
35 It also provides many useful analyses for warnings and generates concise messages in case of error.
36 It uses libFIRM for optimization and code generation.
37 The compiler driver is largely compatible with GCC.
38 .Sh OPTIONS
39 .Bl -tag
40 .It Fl c
41 Compile the input files to object files.
42 The default output filename is the input filename with the extension replaced by .o.
43 .It Fl S
44 Compile the input files to assembler.
45 The default output filename is the input filename with the extension replaced by .s.
46 .It Fl E
47 Preprocess the input file only.
48 By default the result is output to stdout.
49 .It Fl -print-ast
50 Output the abstract syntax tree of the parsed input file as C again.
51 .It Fl -print-implicit-cast
52 When using
53 .Fl -print-ast ,
54 show casts, which are inserted by the semantic checks.
55 .It Fl -print-parenthesis
56 When using
57 .Fl -print-ast ,
58 show all expressions fully parenthesized.
59 .It Fl std= Ns Ar standard
60 Select the language standard.
61 Supported values are:
62 .Bl -tag -compact -width "iso9899:1990"
63 .It Cm c89
64 .It Cm c90
65 .It Cm iso9899:1990
66 ISO C90
67 .It Cm gnu89
68 ISO C90 with GCC extensions
69 .It Cm c99
70 .It Cm iso9899:1999
71 ISO C99
72 .It Cm gnu99
73 ISO C99 with GCC extensions
74 .It Cm c++98
75 ISO C++ 1998.
76 Not supported yet.
77 .It Cm gnu++98
78 ISO C++ 1998 with GCC extensions.
79 Not supported yet.
80 .El
81 .It Fl - Ns Oo Cm no- Oc Ns Cm gcc
82 Disable/enable GCC extensions.
83 This switch supersedes
84 .Fl std .
85 .It Fl - Ns Oo Cm no- Oc Ns Cm ms
86 Disable/enable MSC extensions.
87 .It Fl g
88 When compiling C files, add debug information in
89 .Tn stabs
90 format.
91 .It Fl O Ns Ar level
92 .\" TODO expand
93 Select the optimization level.
94 Sensible values are between 0 and 4, inclusive.
95 .\" TODO expand
96 .It Fl W Ns Ar warning
97 Enable the specified warning.
98 .It Fl Wno- Ns Ar warning
99 Disable the specified warning.
100 .It Fl Werror= Ns Ar warning
101 Enable the specified warning and turn it into an error.
102 .It Fl Wno-error= Ns Ar warning
103 Force the specified warning to only be a warning, even in the presence of
104 .Fl Werror .
105 This neither enables nor disables the warning itself.
106 .It Fl Waddress
107 Warn about suspicious use of addresses, like using the address of a function or variable as boolean condition or comparing with the address of a string literal.
108 .It Fl Waggregate-return
109 Warn about defining or calling a function, which returns a struct or union by value.
110 .It Fl Wall
111 Activate most warnings.
112 In particular these are
113 .Fl Waddress ,
114 .Fl Wattribute ,
115 .Fl Wchar-subscripts ,
116 .Fl Wcomment ,
117 .Fl Wempty-statement ,
118 .Fl Wformat ,
119 .Fl Wimplicit-function-declaration ,
120 .Fl Wimplicit-int ,
121 .Fl Winit-self ,
122 .Fl Wmain ,
123 .Fl Wnonnull ,
124 .Fl Wparentheses ,
125 .Fl Wpointer-arith ,
126 .Fl Wredundant-decls ,
127 .Fl Wreturn-type ,
128 .Fl Wshadow-local ,
129 .Fl Wsign-compare ,
130 .Fl Wstrict-prototypes ,
131 .Fl Wswitch-enum ,
132 .Fl Wunknown-pragmas ,
133 .Fl Wunreachable-code ,
134 .Fl Wunused-function ,
135 .Fl Wunused-label ,
136 .Fl Wunused-parameter ,
137 .Fl Wunused-value ,
138 .Fl Wunused-variable .
139 .It Fl Wcast-qual
140 Warn whenever a pointer cast removes qualifiers from the pointed-to type, e.g. casting a const char* to char*.
141 .It Fl Wchar-subscripts
142 Warn about using an expression of type char as array subscript, e.g. char\ c; arr[c].
143 .It Fl Wdeclaration-after-statement
144 Warn about mixing declarations and statements, which is not allowed prior to C99.
145 .It Fl Wdiv-by-zero
146 Warn about compile-time integer division by zero.
147 .It Fl Wempty-statement
148 Warn about empty statements, i.e. statements which only consist of a single
149 .Sq \&; .
150 Use {} as replacement to avoid this warning.
151 .It Fl Werror
152 Treat warnings as errors, i.e. do not continue after parsing when a warning is encountered.
153 .It Fl Wextra
154 (Alias
155 .Fl W Ns )
156 Activate some more warnings.
157 In particular these are
158 .Fl Wempty-statement ,
159 .Fl Wshadow ,
160 .Fl Wunused-parameter ,
161 .Fl Wunused-value .
162 .It Fl Wfatal-errors
163 Immediately abort compilation when encountering an error.
164 .It Fl Wformat
165 Check format strings of char and wchar_t functions.
166 .It Fl Wimplicit
167 Activate
168 .Fl Wimplicit-function-declaration ,
169 .Fl Wimplicit-int .
170 .It Fl Wimplicit-function-declaration
171 Warn about calling a function without a prior declaration.
172 .It Fl Wimplicit-int
173 Warn about declarations whose declaration specifiers do not include a type specifier.
174 .It Fl Winit-self
175 Warn about uninitialized variables which are initialized with themselves.
176 .It Fl Wlong-long
177 Warn if the type
178 .Sq long long
179 is used.
180 .It Fl Wmain
181 Warn if the type of
182 .Sq main
183 is suspicious, i.e. if it is not a non-static function declared as either int\ main(void), int\ main(int,\ char**) or, as an extension, int\ main(int,\ char**,\ char**).
184 .It Fl Wmissing-declarations
185 Warn if a non-static function or a global variable without a storage class is defined without a prior declaration.
186 This is typically a sign of a missing #include or that the object should be static.
187 .It Fl Wmissing-noreturn
188 Warn about functions, which are candidates for the attribute
189 .Sq noreturn .
190 .It Fl Wmissing-prototypes
191 Warn if a global function is defined without a previous prototype declaration.
192 .It Fl Wmultichar
193 Warn if a multicharacter constant
194 .Pf ( Sq FOOF )
195 is used.
196 .It Fl Wnested-externs
197 Warn if an
198 .Sq extern
199 declaration is encountered within a function.
200 .It Fl Wparentheses
201 Warn if parentheses are omitted in certain contexts.
202 Warn if an assignment is used as condition, e.g. if\ (x\ =\ 23).
203 Warn if && without parentheses is used within ||, e.g. if\ (x\ ||\ y\ &&\ z).
204 Warn if it there may be confusion which
205 .Sq if Ns
206 -statement an
207 .Sq else Ns
208 -branch belongs to, e.g. if\ (x)\ if\ (y)\ {}\ else\ {}.
209 Warn if cascaded comparisons appear which do not have their mathematical meaning, e.g. if\ (23\ <=\ x\ <\ 42).
210 Warn if + or - is used as operand of << or >>, e.g. x\ +\ y\ <<\ z.
211 .It Fl Wredundant-decls
212 Warn about redundant declarations, i.e. multiple declarations of the same object or static forward declarations which have no use before their definition.
213 .It Fl Wshadow
214 Warn when a new declaration shadows another declaration with the same name in an outer scope.
215 .It Fl Wshadow-local
216 Like
217 .Fl Wshadow ,
218 but only warn if the shadowed declaration is not global, e.g. a local variable shadows a parameter or another local variable.
219 .It Fl Wunreachable-code
220 Warn when the compiler determines that a statement (or in some cases a part thereof) will never be executed.
221 .It Fl Wunused
222 Activate
223 .Fl Wunused-function ,
224 .Fl Wunused-label ,
225 .Fl Wunused-parameter ,
226 .Fl Wunused-value ,
227 .Fl Wunused-variable .
228 .It Fl Wunused-parameter
229 Warn when a parameter is never used or only ever read to calculate its own new value, e.g. x\ =\ x\ +\ 1.
230 .It Fl Wunused-variable
231 Warn when a variable is never used or only ever read to calculate its own new value, e.g. x\ =\ x\ +\ 1.
232 .It Fl w
233 Suppress all warnings.
234 .It Fl I Ar dir
235 Add the directory
236 .Ar dir
237 to the paths to be searched for include files.
238 .It Fl L Ar dir
239 Add the directory
240 .Ar dir
241 to the paths to be searched for libraries.
242 .It Fl D Ns Ar macro
243 Define the preprocessor macro
244 .Ar macro
245 which will expand to 1.
246 .It Fl D Ns Ar macro=defn
247 Define the preprocessor macro
248 .Ar macro
249 and set its expanded value to
250 .Ar defn .
251 .It Fl U Ns Ar macro
252 Undefine the preprocessor macro
253 .Ar macro .
254 .It Fl f Ar option
255 Set a frontend or optimizer option.
256 Use
257 .Fl fhelp
258 to get a list of supported optimizer options.
259 .It Fl f Ns Oo Cm no- Oc Ns Cm diagnostics-show-option
260 Show the switch, which controls a warning, after each warning.
261 Default is on.
262 .It Fl finput-charset= Ns Ar encoding
263 Select the encoding of the input.
264 Supported values are
265 .Cm ISO_8859-1:1987
266 (aliases
267 .Cm CP819 ,
268 .Cm IBM819 ,
269 .Cm ISO-8859-1 ,
270 .Cm ISO8859-1 ,
271 .Cm ISO_8859-1 ,
272 .Cm csISOLatin1 ,
273 .Cm iso-ir-100 ,
274 .Cm l1
275 and
276 .Cm latin1 Ns
277 ),
278 .Cm ISO-8859-15
279 (aliases
280 .Cm ISO8859-15 ,
281 .Cm ISO_8859-15
282 and
283 .Cm Latin-9 Ns
284 ),
285 .Cm windows-1252
286 (alias
287 .Cm cp1252 Ns
288 ) and
289 .Cm UTF-8
290 (default).
291 Case is ignored.
292 .It Fl f Ns Oo Cm no- Oc Ns Cm show-column
293 Show the column number in diagnostic messages.
294 .It Fl fsigned-char
295 Define
296 .Sq char
297 to have the same range, representation and behaviour as
298 .Sq signed char .
299 .It Fl funsigned-char
300 Define
301 .Sq char
302 to have the same range, representation and behaviour as
303 .Sq unsigned char .
304 .It Fl b Ar option
305 Set a backend option.
306 Use
307 .Fl bhelp
308 to get a list of supported options.
309 .It Fl l Ar library
310 Link with the specified library.
311 .It Fl o Ar outfile
312 Specify the output filename.
313 This is only valid when using a single input filename.
314 .Fl
315 as filename uses stdout for output.
316 .It Fl x Ar language
317 Overwrite the language auto-detection for the following filenames by the
318 specified
319 .Ar language .
320 Supported values are:
321 .Bl -tag -compact -width "assembler-with-cpp"
322 .It Cm assembler
323 Assembler file
324 .It Cm assembler-with-cpp
325 Assembler file, which needs to be preprocessed
326 .It Cm c
327 .It Cm c-header
328 C file
329 .It Cm c++
330 .It Cm c++-header
331 C++ file
332 .It Cm none
333 Revert to auto-detection
334 .El
335 .It Fl Wl, Ns Ar option
336 Pass
337 .Ar option
338 to the linker.
339 .It Fl Wp, Ns Ar option
340 Pass
341 .Ar option
342 to the preprocessor.
343 .El
344 .Sh SEE ALSO
345 .Xr gcc 1 ,
346 http://www.libfirm.org/
347 .Sh BUGS
348 Probably many - if you hit one, please report it.
349 .Pp
350 .Nm
351 needs to support more switches for better GCC compatibility.
352 .Pp
353 This manual page is incomplete.
354 .Sh AUTHORS
355 .An -nosplit
356 .Nm
357 was written by
358 .An Matthias Braun
359 .Aq matze@braunis.de ,
360 .An Christoph Mallon
361 .Aq christoph.mallon@gmx.de
362 and
363 .An Michael Beck .