Start writing a manpage for cparser.
[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 std= Ns Ar standard
11 .Op Fl - Ns Oo Cm no- Oc Ns Cm gcc
12 .Op Fl - Ns Oo Cm no- Oc Ns Cm ms
13 .Op Fl g
14 .Op Fl O Ns Ar level
15 .Op Fl W Ns Oo Cm no- Oc Ns Ar warn
16 .Op Fl w
17 .Op Fl I Ar dir
18 .Op Fl L Ar dir
19 .Op Fl D Ns Ar macro Ns Op Ar =defn
20 .Op Fl U Ns Ar macro
21 .Op Fl f Ar option
22 .Op Fl b Ar option
23 .Op Fl l Ar library
24 .Op Fl o Ar outfile
25 .Op Fl x Ar language
26 .Ar
27 .Sh DESCRIPTION
28 .Nm
29 is a C compiler, which can parse C90 and C99 as well as many GCC and some MSC extensions.
30 It also provides many useful analyses for warnings and generates concise messages in case of error.
31 It uses libFIRM for optimization and code generation.
32 The compiler driver is largely compatible with GCC.
33 .Sh OPTIONS
34 .Bl -tag
35 .It Fl c
36 Compile the input files to object files.
37 The default output filename is the input filename with the extension replaced by .o.
38 .It Fl S
39 Compile the input files to assembler.
40 The default output filename is the input filename with the extension replaced by .s.
41 .It Fl E
42 Preprocess the input file only.
43 By default the result is output to stdout.
44 .It Fl -print-ast
45 Output the abstract syntax tree of the parsed input file as C again.
46 .It Fl std= Ns Ar standard
47 Select the language standard.
48 Supported values are:
49 .Bl -tag -compact -width "iso9899:1990"
50 .It Cm c89
51 .It Cm iso9899:1990
52 ISO C90
53 .It Cm gnu89
54 ISO C90 with GCC extensions
55 .It Cm c99
56 .It Cm iso9899:1999
57 ISO C99
58 .It Cm gnu99
59 ISO C99 with GCC extensions
60 .It Cm c++98
61 ISO C++ 1998.
62 Not supported yet.
63 .It Cm gnu++98
64 ISO C++ 1998 with GCC extensions.
65 Not supported yet.
66 .El
67 .It Fl - Ns Oo Cm no- Oc Ns Cm gcc
68 Disable/enable GCC extensions.
69 This switch supersedes
70 .Fl std .
71 .It Fl - Ns Oo Cm no- Oc Ns Cm ms
72 Disable/enable MSC extensions.
73 .It Fl g
74 When compiling C files, add debug information in
75 .Tn stabs
76 format.
77 .It Fl O Ns Ar level
78 .\" TODO expand
79 Select the optimization level.
80 Sensible values are between 0 and 4, inclusive.
81 .It Fl W Ns Oo Cm no- Oc Ns Ar warn
82 .\" TODO expand
83 Disable/enable a specific warning.
84 Every warning option has a corresponding
85 .Cm no-
86 switch to deactivate it.
87 .It Fl Waddress
88 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.
89 .It Fl Wall
90 Activate most warnings.
91 In particular these are
92 .Fl Waddress ,
93 .Fl Wattribute ,
94 .Fl Wchar-subscripts ,
95 .Fl Wcomment ,
96 .Fl Wempty-statement ,
97 .Fl Wformat ,
98 .Fl Wimplicit-function-declaration ,
99 .Fl Wimplicit-int ,
100 .Fl Winit-self ,
101 .Fl Wmain ,
102 .Fl Wnonnull ,
103 .Fl Wpointer-arith ,
104 .Fl Wredundant-decls ,
105 .Fl Wreturn-type ,
106 .Fl Wshadow ,
107 .Fl Wsign-compare ,
108 .Fl Wstrict-prototypes ,
109 .Fl Wswitch-enum ,
110 .Fl Wunknown-pragmas ,
111 .Fl Wunreachable-code ,
112 .Fl Wunused-function ,
113 .Fl Wunused-label ,
114 .Fl Wunused-parameter ,
115 .Fl Wunused-value ,
116 .Fl Wunused-variable .
117 .It Fl Wdeclaration-after-statement
118 Warn about mixing declarations and statements, which is not allowed prior to C99.
119 .It Fl Wempty-statement
120 Warn about empty statements, i.e. statements which only consist of a single ';'.
121 Use {} as replacement to avoid this warning.
122 .It Fl Werror
123 Treat warnings as errors, i.e. abort compilation when a warning is encountered.
124 .It Fl Wextra
125 Activate some more warnings.
126 In particular these are
127 .Fl Wempty-statement ,
128 .Fl Wunused-parameter ,
129 .Fl Wunused-value .
130 .It Fl Wformat
131 Check format strings of char and wchar_t functions.
132 .It Fl Wimplicit
133 Activate
134 .Fl Wimplicit-function-declaration ,
135 .Fl Wimplicit-int .
136 .It Fl Wimplicit-function-declaration
137 Warn about calling a function without a prior declaration.
138 .It Fl Wimplicit-int
139 Warn about declarations whose declaration specifiers do not include a type specifier.
140 .It Fl Wredundant-decls
141 Warn about redundant declarations, i.e. multiple declarations of the same object or static forward declarations which have no use before their definition.
142 .It Fl Wunreachable-code
143 Warn when the compiler determines that a statement (or in some cases a part thereof) will never be executed.
144 .It Fl Wunused
145 Activate
146 .Fl Wunused-function ,
147 .Fl Wunused-label ,
148 .Fl Wunused-parameter ,
149 .Fl Wunused-value ,
150 .Fl Wunused-variable .
151 .It Fl Wunused-parameter
152 Warn when a parameter is never used or only ever read to calculate its own new value, e.g. x = x + 1.
153 .It Fl Wunused-variable
154 Warn when a variable is never used or only ever read to calculate its own new value, e.g. x = x + 1.
155 .It Fl w
156 Suppress all warnings.
157 .It Fl I Ar dir
158 Add the directory
159 .Ar dir
160 to the paths to be searched for include files.
161 .It Fl L Ar dir
162 Add the directory
163 .Ar dir
164 to the paths to be searched for libraries.
165 .It Fl D Ns Ar macro
166 Define the preprocessor macro
167 .Ar macro
168 which will expand to 1.
169 .It Fl D Ns Ar macro=defn
170 Define the preprocessor macro
171 .Ar macro
172 and set its expanded value to
173 .Ar defn .
174 .It Fl U Ns Ar macro
175 Undefine the preprocessor macro
176 .Ar macro .
177 .It Fl f Ar option
178 Set a frontend or optimizer option.
179 Use
180 .Fl fhelp
181 to get a list of supported optimizer options.
182 .It Fl b Ar option
183 Set a backend option.
184 Use
185 .Fl bhelp
186 to get a list of supported options.
187 .It Fl l Ar library
188 Link with the specified library.
189 .It Fl o Ar outfile
190 Specify the output filename.
191 This is only valid when using a single input filename.
192 .Fl
193 as filename uses stdout for output.
194 .It Fl x Ar language
195 Overwrite the language auto-detection for the following filenames by the
196 specified
197 .Ar language .
198 Supported values are:
199 .Bl -tag -compact -width "assembler-with-cpp"
200 .It Cm assembler
201 Assembler file
202 .It Cm assembler-with-cpp
203 Assembler file, which needs to be preprocessed
204 .It Cm c
205 .It Cm c-header
206 C file
207 .It Cm c++
208 .It Cm c++-header
209 C++ file
210 .It Cm none
211 Revert to auto-detection
212 .El
213 .El
214 .Sh SEE ALSO
215 .Xr gcc 1 ,
216 http://www.libfirm.org/
217 .Sh BUGS
218 Probably many - if you hit one, please report it.
219 .Pp
220 .Nm
221 needs to support more switches for better GCC compatibility.
222 .Sh AUTHORS
223 .An -nosplit
224 .Nm
225 was written by
226 .An Matthias Braun
227 .Aq matze@braunis.de ,
228 .An Christoph Mallon
229 .Aq christoph.mallon@gmx.de
230 and
231 .An Michael Beck .