Implement (and document \o/) -Werror-implicit-function-declaration.
[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 Werror-implicit-function-declaration
143 Generate an error, when calling a function without a prior declaration.
144 .It Fl Wextra
145 Activate some more warnings.
146 In particular these are
147 .Fl Wempty-statement ,
148 .Fl Wunused-parameter ,
149 .Fl Wunused-value .
150 .It Fl Wfatal-errors
151 Immediately abort compilation when encountering an error.
152 .It Fl Wformat
153 Check format strings of char and wchar_t functions.
154 .It Fl Wimplicit
155 Activate
156 .Fl Wimplicit-function-declaration ,
157 .Fl Wimplicit-int .
158 .It Fl Wimplicit-function-declaration
159 Warn about calling a function without a prior declaration.
160 .It Fl Wimplicit-int
161 Warn about declarations whose declaration specifiers do not include a type specifier.
162 .It Fl Winit-self
163 Warn about uninitialized variables which are initialized with themselves.
164 .It Fl Wlong-long
165 Warn if the type 'long long' is used.
166 .It Fl Wmain
167 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**).
168 .It Fl Wmissing-declarations
169 Warn if a non-static function or a global variable without a storage class is defined without a prior declaration.
170 This is typically a sign of a missing #include or that the object should be static.
171 .It Fl Wmissing-noreturn
172 Warn about functions, which are candidates for the attribute 'noreturn'.
173 .It Fl Wmissing-prototypes
174 Warn if a global function is defined without a previous prototype declaration.
175 .It Fl Wmultichar
176 Warn if a multicharacter constant ('FOOF') is used.
177 .It Fl Wnested-externs
178 Warn if an 'extern' declaration is encountered within a function.
179 .It Fl Wredundant-decls
180 Warn about redundant declarations, i.e. multiple declarations of the same object or static forward declarations which have no use before their definition.
181 .It Fl Wunreachable-code
182 Warn when the compiler determines that a statement (or in some cases a part thereof) will never be executed.
183 .It Fl Wunused
184 Activate
185 .Fl Wunused-function ,
186 .Fl Wunused-label ,
187 .Fl Wunused-parameter ,
188 .Fl Wunused-value ,
189 .Fl Wunused-variable .
190 .It Fl Wunused-parameter
191 Warn when a parameter is never used or only ever read to calculate its own new value, e.g. x = x + 1.
192 .It Fl Wunused-variable
193 Warn when a variable is never used or only ever read to calculate its own new value, e.g. x = x + 1.
194 .It Fl w
195 Suppress all warnings.
196 .It Fl I Ar dir
197 Add the directory
198 .Ar dir
199 to the paths to be searched for include files.
200 .It Fl L Ar dir
201 Add the directory
202 .Ar dir
203 to the paths to be searched for libraries.
204 .It Fl D Ns Ar macro
205 Define the preprocessor macro
206 .Ar macro
207 which will expand to 1.
208 .It Fl D Ns Ar macro=defn
209 Define the preprocessor macro
210 .Ar macro
211 and set its expanded value to
212 .Ar defn .
213 .It Fl U Ns Ar macro
214 Undefine the preprocessor macro
215 .Ar macro .
216 .It Fl f Ar option
217 Set a frontend or optimizer option.
218 Use
219 .Fl fhelp
220 to get a list of supported optimizer options.
221 .It Fl b Ar option
222 Set a backend option.
223 Use
224 .Fl bhelp
225 to get a list of supported options.
226 .It Fl l Ar library
227 Link with the specified library.
228 .It Fl o Ar outfile
229 Specify the output filename.
230 This is only valid when using a single input filename.
231 .Fl
232 as filename uses stdout for output.
233 .It Fl x Ar language
234 Overwrite the language auto-detection for the following filenames by the
235 specified
236 .Ar language .
237 Supported values are:
238 .Bl -tag -compact -width "assembler-with-cpp"
239 .It Cm assembler
240 Assembler file
241 .It Cm assembler-with-cpp
242 Assembler file, which needs to be preprocessed
243 .It Cm c
244 .It Cm c-header
245 C file
246 .It Cm c++
247 .It Cm c++-header
248 C++ file
249 .It Cm none
250 Revert to auto-detection
251 .El
252 .El
253 .Sh SEE ALSO
254 .Xr gcc 1 ,
255 http://www.libfirm.org/
256 .Sh BUGS
257 Probably many - if you hit one, please report it.
258 .Pp
259 .Nm
260 needs to support more switches for better GCC compatibility.
261 .Pp
262 This manual page is incomplete.
263 .Sh AUTHORS
264 .An -nosplit
265 .Nm
266 was written by
267 .An Matthias Braun
268 .Aq matze@braunis.de ,
269 .An Christoph Mallon
270 .Aq christoph.mallon@gmx.de
271 and
272 .An Michael Beck .