X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=doc%2Fgmqcc.1;h=ed88235ebbf77972405a4f4d91a2eb2b57fa218b;hp=9d6c5ce6ef0404c415e2185a942c3c341cf8112f;hb=52312791130eff70f21c428b23756a1b49e67804;hpb=dae1291b37b771697aed139375f6597f1944d55a diff --git a/doc/gmqcc.1 b/doc/gmqcc.1 index 9d6c5ce..ed88235 100644 --- a/doc/gmqcc.1 +++ b/doc/gmqcc.1 @@ -59,7 +59,14 @@ some others. Warnings and errors will of course still be displayed. Enable or disable a warning. .TP .B -Wall -Enable all warnings. Overrides preceding -W parameters. +Enable almost all warnings. Overrides preceding -W parameters. +.sp +The following warnings will \fBnot\fR be anbled: +.in +4 +.nf +-Wuninitialized-global +.fi +.in .TP .BR -Werror ", " -Wno-error Controls whether or not all warnings should be treated as errors. @@ -101,8 +108,20 @@ them. .sp .BR -std=gmqcc " includes:" .in +4 +.nf -fadjust-vector-fields +-fcorrect-logic +-ftrue-empty-strings +-floop-labels +-finitialized-nonconstants +-ftranslatable-strings +-f\fIno-\fRfalse-empty-strings +-Winvalid-parameter-count +-Wmissing-returnvalues +-fcorrect-ternary (cannot be turned off) +.fi .in +.sp .BR -std=qcc " includes:" .in +4 .nf @@ -110,6 +129,7 @@ them. -f\fIno-\fRadjust-vector-fields .fi .in +.sp .BR -std=fteqcc " includes:" .in +4 .nf @@ -122,6 +142,15 @@ them. .fi .in .TP +.B "--add-info" +Adds compiler information to the generated binary file. Currently +this includes the following globals: +.RS +.IP "reserved:version" +String containing the compiler version as printed by the --version +parameter. +.RE +.TP .B "-dump" DEBUG OPTION. Print the code's intermediate representation before the optimization and finalization passes to stdout before generating the @@ -165,9 +194,8 @@ optionally enable a warning. Functions which aren't of type \fIvoid\fR will warn if it possible to reach the end without returning an actual value. .TP -.B -Wtoo-few-parameters -Warn about a function call with fewer parameters than the function -expects. +.B -Winvalid-parameter-count +Warn about a function call with an invalid number of parameters. .TP .B -Wlocal-shadows Warn when a locally declared variable shadows variable. @@ -261,6 +289,33 @@ the actual attribute syntax is better defined. .TP .B -Wreserved-names Warn when using reserved names such as 'nil'. +.TP +.B -Wuninitialized-constant +Warn about global constants (using the 'const' keyword) with no +assigned value. +.TP +.B -Wuninitialized-global +Warn about global variables with no initializing value. This is off by +default, and is added mostly to help find null-values which are +supposed to be replaced by the untyped 'nil' constant. +.TP +.B -Wdifferent-qualifiers +Warn when a variables is redeclared with a different qualifier. For +example when redeclaring a variable as \'var\' which was previously +marked \'const\'. +.TP +.B -Wdifferent-attributes +Similar to the above but for attributes like "[[noreturn]]". +.TP +.B -Wdeprecated +Warn when a function is marked with the attribute +"[[deprecated]]". This flag enables a warning on calls to functions +marked as such. +.TP +.B -Wparenthesis +Warn about possible mistakes caused by missing or wrong parenthesis, +like an assignment in an 'if' condition when there's no additional set +of parens around the assignment. .SH COMPILE FLAGS .TP .B -fdarkplaces-string-table-bug @@ -293,10 +348,12 @@ __COUNTER__ __COUNTER_LAST__ __RANDOM__ __RANDOM_LAST__ +__DATE__ +__TIME__ .fi .in -Note that fteqcc also defines __FUNC__, __TIME__, __DATE__ and -__NULL__, which are not yet implemented. +Note that fteqcc also defines __NULL__ which is not implemented yet. +(See -funtyped-nil about gmqcc's alternative to __NULL__). .TP .B -frelaxed-switch Allow switch cases to use non constant variables. @@ -399,6 +456,19 @@ Adds a global named 'nil' which is of no type and can be assigned to anything. No typechecking will be performed on assignments. Assigning to it is forbidden, using it in any other kind of expression is also not allowed. +.sp +Note that this is different from fteqcc's __NULL__: In fteqcc, +__NULL__ maps to the integer written as '0i'. It's can be assigned to +function pointers and integers, but it'll error about invalid +instructions when assigning it to floats without enabling the FTE +instruction set. There's also a bug which allows it to be assigned to +vectors, for which the source will be the global at offset 0, meaning +the vector's y and z components will contain the OFS_RETURN x and y +components. +.sp +In that gmqcc the nil global is an actual global filled with zeroes, +and can be assigned to anything including fields, vectors or function +pointers, and they end up becoming zeroed. .TP .B -fpermissive Various effects, usually to weaken some conditions. @@ -406,6 +476,7 @@ Various effects, usually to weaken some conditions. .IP "with -funtyped-nil" Allow local variables named 'nil'. (This will not allow declaring a global of that name.) +.RE .SH OPTIMIZATIONS .TP .B -Opeephole @@ -481,6 +552,15 @@ instruction is added for several reasons. (For example the qcvm's disassemble switch uses it to know when the function ends.). This optimization replaces that last RETURN with DONE rather than adding the DONE additionally. +.TP +.B -Ovector-components +Because traditional QC code doesn't allow you to access individual +vector components of a computed vector without storing it in a local +first, sometimes people multiply it by a constant like '0 1 0' to get, +in this case, the y component of a vector. This optimization will turn +such a multiplication into a direct component access. If the factor is +anything other than 1, a float-multiplication will be added, which is +still faster than a vector multiplication. .SH CONFIG The configuration file is similar to regular .ini files. Comments start with hashtags or semicolons, sections are written in square