1 .\" Process with groff -man -Tascii file.3
2 .TH GMQCC 1 2012-07-12 "" "gmqcc Manual"
4 gmqcc \- A Quake C compiler built from the NIH realm of sarcastic wit
7 [\fIOPTIONS\fR] [\fIfiles...\fR]
9 Traditionally, a QC compiler reads the file \fIprogs.src\fR which
10 in its first line contains the output filename, and the rest is a
11 list of QC source files that are to be compiled in order.
12 \fBgmqcc\fR optionally takes options to specify the output and
13 input files on the commandline, and also accepts assembly files.
15 \fBgmqcc\fR mostly tries to mimick gcc's commandline handling, though
16 there are also traditional long-options available.
19 Show a usage message and exit.
22 Turn on some compiler debugging mechanisms.
25 Turn on compiler mem-check. (Shows allocations and checks for leaks.)
27 .BI "-o, --output=" filename
28 Specify the output filename. Defaults to progs.dat. This will overwrite
29 the output file listed in a \fIprogs.src\fR file in case such a file is used.
32 Specify the optimization level
35 Highest optimization level
37 Default optimization level
39 Minimal optimization level
41 Disable optimization entirely
44 .BI "-O" name "\fR, " "" -Ono- name
45 Enable or disable a specific optimization. Note that these options
46 must be used after setting the optimization level, otherwise they'll
50 List all possible optimizations and the optimization level they're
53 .BI -W warning "\fR, " "" -Wno- warning
54 Enable or disable a warning.
57 Enable all warnings. Overrides preceding -W parameters.
59 .BR -Werror ", " -Wno-error
60 Controls whether or not all warnings should be treated as errors.
62 .BI -Werror- warning "\fR, " "" -Wno-error- warning
63 Controls whether a specific warning should be an error.
66 List all possible warn flags.
68 .BI -f flag "\fR, " "" -fno- flag
69 Enable or disable a specific compile flag. See the list of flags
73 List all possible compile flags.
76 Disables colored output
79 Use an ini file to read all the -O, -W and -f flag from. See the
80 CONFIG section about the file format.
83 Redirects standard output to a \fIfile\fR
86 Redirects standard error to a \fIfile\fR
89 Use the specified standard for parsing QC code. The following standards
91 .IR gmqcc , qcc , fteqcc
92 Selecting a standard also implies some -f options and behaves as if
93 those options have been written right after the -std option, meaning
94 if you changed them before the -std option, you're now overwriting
97 .BR -std=gmqcc " includes:"
99 -fadjust-vector-fields
101 .BR -std=qcc " includes:"
104 -fassign-function-types
105 -f\fIno-\fRadjust-vector-fields
108 .BR -std=fteqcc " includes:"
112 -ftranslatable-strings
113 -fassign-function-types
115 -f\fIno-\fRadjust-vector-fields
116 -f\fIno-\fRcorrect-ternary
122 Generate a warning about variables which are declared but never used.
123 This can be avoided by adding the \fInoref\fR keyword in front of the
124 variable declaration. Additionally a complete section of unreferenced
125 variables can be opened using \fI#pragma noref 1\fR, and closed via
126 \fI#pragma noref 0\fR.
128 .B -Wused-uninitialized
129 Generate a warning if it is possible that a variable can be used
130 without prior initialization. Note that this warning is not
131 necessarily reliable if the initialization happens only under certain
132 conditions. The other way is \fInot\fR possible: that the warning is
133 \fInot\fR generated when uninitialized use \fIis possible\fR.
135 .B -Wunknown-control-sequence
136 Generate an error when an unrecognized control sequence in a string is
137 used. Meaning: when there's a character after a backslash in a string
138 which has no known meaning.
141 Warn when using special extensions which are not part of the selected
144 .B -Wfield-redeclared
145 Generally QC compilers ignore redeclaration of fields. Here you can
146 optionally enable a warning.
148 .B -Wmissing-return-values
149 Functions which aren't of type \fIvoid\fR will warn if it possible to
150 reach the end without returning an actual value.
152 .B -Wtoo-few-parameters
153 Warn about a function call with fewer parameters than the function
157 Warn when a locally declared variable shadows variable.
160 Warn when the initialization of a local variable turns the variable
161 into a constant. This is default behaviour unless
162 \fI-finitialized-nonconstants\fR is used.
165 There are only 2 known global variables of type void: end_sys_globals
166 and end_sys_fields. Any other void-variable will warn.
168 .B -Wimplicit-function-pointer
169 A global function which is not declared with the \fIvar\fR keyword is
170 expected to have an implementing body, or be a builtin. If neither is
171 the case, it implicitly becomes a function pointer, and a warning is
174 .B -Wvariadic-function
175 Currently there's no way for an in QC implemented function to access
176 variadic parameters. If a function with variadic parameters has an
177 implementing body, a warning will be generated.
180 Generate warnings about \fI$frame\fR commands, for instance about
181 duplicate frame definitions.
183 .B -Weffectless-statement
184 Warn about statements which have no effect. Any expression which does
185 not call a function or assigns a variable.
188 The \fIend_sys_fields\fR variable is supposed to be a global variable
189 of type \fIvoid\fR. It is also recognized as a \fIfield\fR but this
190 will generate a warning.
192 .B -Wassign-function-types
193 Warn when assigning to a function pointer with an unmatching
194 signature. This usually happens in cases like assigning the null
195 function to an entity's .think function pointer.
198 Enable warnings coming from the preprocessor. Like duplicate macro
202 Warn if there's a preprocessor \fI#if\fR spanning across several
205 .B -Wdouble-declaration
206 Warn about multiple declarations of globals. This seems pretty common
207 in QC code so you probably do not want this unless you want to clean
211 The combination of \fIconst\fR and \fIvar\fR is not illegal, however
212 different compilers may handle them differently. We were told, the
213 intention is to create a function-pointer which is not assignable.
214 This is exactly how we interpret it. However for this interpretation
215 the \fIvar\fR keyword is considered superfluous (and philosophically
216 wrong), so it is possible to generate a warning about this.
218 .B -Wmultibyte-character
219 Warn about multibyte character constants, they do not work right now.
221 .B -Wternary-precedence
222 Warn if a ternary expression which contains a comma operator is used
223 without enclosing parenthesis, since this is most likely not what you
224 actually want. We recommend the \fI-fcorrect-ternary\fR option.
227 Warn when encountering an unrecognized \fI#pragma\fR line.
229 .B -Wunreachable-code
230 Warn about unreachable code. That is: code after a return statement,
231 or code after a call to a function marked as 'noreturn'.
234 Enable some warnings added in order to help debugging in the compiler.
239 Allow local variables to overlap with each other if they don't
240 interfer with each other. (Not implemented right now)
242 .B -fdarkplaces-string-table-bug
243 Add some additional characters to the string table in order to
244 compensate for a wrong boundcheck in some specific version of the
247 .B -fadjust-vector-fields
248 When assigning to field pointers of type \fI.vector\fR the common
249 behaviour in compilers like \fIfteqcc\fR is to only assign the
250 x-component of the pointer. This means that you can use the vector as
251 such, but you cannot use its y and z components directly. This flag
252 fixes this behaviour. Before using it make sure your code does not
253 depend on the buggy behaviour.
256 Enable a partially fteqcc-compatible preprocessor. It supports all the
257 features used in the Xonotic codebase. If you need more, write a
261 Allow switch cases to use non constant variables.
264 Perform early out in logical AND and OR expressions. The final result
265 will be either a 0 or a 1, see the next flag for more possibilities.
268 In many languages, logical expressions perform early out in a special
269 way: If the left operand of an AND yeilds true, or the one of an OR
270 yields false, the complete expression evaluates to the right side.
271 Thus \fItrue && 5\fI evaluates to 5 rather than 1.
273 .B -ftranslatable-strings
274 Enable the underscore intrinsic: Using \fI_("A string constant")\fR
275 will cause the string immediate to get a name with a "dotranslate_"
276 prefix. The darkplaces engine recognizes these and translates them in
277 a way similar to how gettext works.
279 .B -finitialized-nonconstants
280 Don't implicitly convert initialized variables to constants. With this
281 flag, the \fIconst\fR keyword is required to make a constant.
283 .B -fassign-function-types
284 If this flag is not set, (and it is set by default in the qcc and
285 fteqcc standards), assigning function pointers of mismatching
286 signatures will result in an error rather than a warning.
289 Produce a linenumber file along with the output .dat file.
292 Use C's operator precedence for ternary expressions. Unless your code
293 depends on fteqcc-compatible behaviour, you'll want to use thi
296 .B -fsingle-vector-defs
297 Normally vectors generate 4 defs, once for the vector, and once for
298 its components with _x, _y, _z suffixes. This option
299 prevents components from being listed.
301 The configuration file is similar to regular .ini files. Comments
302 start with hashtags or semicolons, sections are written in square
303 brackets and in each section there can be arbitrary many key-value
306 There are 3 sections currently:
307 .IR flags ", " warnings ", and " optimizations .
308 They contain a list of boolean values of the form `VARNAME = true` or
309 `VARNAME = false`. The variable names are the same as for the
310 corresponding -W, -f or -O flag written with only capital letters and
311 dashes replaced by underscores.
316 # a GMQCC configuration file
319 ADJUST_VECTOR_FIELDS = false
323 UNUSED_VARIABLE = false
324 USED_UNINITIALIZED = true
328 TAIL_RECURSION = true
332 Please report bugs on <http://github.com/graphitemaster/gmqcc/issues>,
333 or see <http://graphitemaster.github.com/gmqcc> on how to contact us.
337 See <http://graphitemaster.github.com/gmqcc>.