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