#warning
directive. The directive must be placed on a separate line.
#warning {enable|disable} [warning_category [warning_category...]]
#include
or #appendto directives does not affect, and is itself not
affected by, the warning settings of the current script.
| Category | Description |
|---|---|
| invalid_escape_sequence |
The engine found an escape sequence inside a string that it
did not recognize.
"\p" |
| invalid_hex_escape |
The engine found the start of a hexadecimal escape sequence
inside a string, but no hexadecimal digits followed it.
"\xGN" |
| type_name_used_as_par_name |
A function parameter was declared without an explicit type
specification, but with a name that is the same as a built-in type.
func f(array)
This warning is not enabled by default.
¹
|
| empty_parameter_in_call |
In a function call, a parameter was left empty. The engine is
passing
nil in its place.
CreateObject(Clonk,, 30, 100);
This warning is not enabled by default.
¹
|
| empty_parameter_in_array |
In an array literal, an entry was left empty. The engine is
using
nil in its place.
[1, 2,, 3, 4]
This warning is not enabled by default.
¹
|
| implicit_range_loop_var_decl |
The loop variable of a for-in loop was not declared either in the
loop header itself nor in the containing function. This is only
accepted for backwards compatibility and may be removed in a
future release. Explicitly declare the variable by adding the
var keyword.
func f() {
for (i in [1, 2, 3]) {
}
}
|
| non_global_var_is_never_const |
A variable has been declared as
const, but is not
global. At this time, non-global variables are always mutable.
const local a = {}
|
| variable_shadows_variable |
The declaration of a variable uses the same name as a variable
in a greater scope. Changes to the shadowing variable will not
affect the shadowed variable.
static foo;
func f() {
var foo = 3;
}
|
| redeclaration |
A variable has been redeclared in the same scope. Make sure
you do not accidentally overwrite values another part of the
code relies upon.
func f() {
var i;
var i;
}
|
| undeclared_varargs |
Use of
Par inside a function
implicitly declares it as using a variable number of arguments.
This is not immediately obvious to callers of the function, and
should be explicitly declared in the function signature by
adding a final ... parameter.
func f(a) {
return Par(a);
}
// Better:
func g(a, ...) {
return Par(a);
}
|
| arg_count_mismatch |
A function call passes more parameters than the function will
accept.
GetDir(0) |
| arg_type_mismatch |
The parameter given in a function call is of a different type
than the called function expects. The call will likely fail at
runtime.
Sin("huh?") |
| empty_if |
An
if conditional is controlling an empty statement.
Use the empty block {} if this is intentional, or
remove the conditional entirely.
if (true); |
func f(string s) {
Sin(s); // WARNING: parameter 0 of call to 'Sin' passes string (int expected)
#warning disable arg_type_mismatch
Sin(s);
#warning enable arg_type_mismatch
Sin(s); // WARNING: parameter 0 of call to 'Sin' passes string (int expected)
}