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