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