Adds a new warning to warn users when they pass an array/string literal to a non-const qualified parameter.
```
f1(arr[]) {
new a = arr[0];
#pragma unused a
}
f2(arr[5]) {
new a = arr[0];
#pragma unused a
}
f3(const arr[]) {
new a = arr[0];
#pragma unused a
}
f4(const arr[5]) {
new a = arr[0];
#pragma unused a
}
main () {
f1("test");
f2("test");
f3("test");
f4("test");
new arr[5];
f1(arr);
f2(arr);
f3(arr);
f4(arr);
f1(arr[0]);
//f2(arr[0]); - array size must match
f3(arr[0]);
//f4(arr[0]); - array size must match
}
```
```
test.pwn(1) : warning 214: possibly a "const" array argument was intended: "arr"
test.pwn(6) : warning 214: possibly a "const" array argument was intended: "arr"
test.pwn(20) : warning 239: literal array/string passed to a non-const parameter
test.pwn(21) : warning 239: literal array/string passed to a non-const parameter
```
1. Adds a generic new warning which is triggered when meaningless combination of class specifiers are used.
2. This commit adds code to trigger a warning for the following two cases:
- constant reference
- - not meaningful as as references always point to cells in PAWN (unlike C++ where it would help costly copies while guaranteeing to not modify the object) which makes const reference is as good as pass-by-value
- constant variable arguments
- - for similar reasons as in the previous case
Only reparse if the function has a tagged result (old behavior) or a
global variable is passed as one of its arguments at some point before
declaration/definition.
Also warn if need to reparse so that developers are aware of potential
performance hit.
Fixes#131.
This removes all scpack-packed strings and moves normal strings from
.scp files to corresponding .c files. The code responding for packing
and unpacking is gone as well.
If you have enough memory to run a SA-MP server you most likely have
more than enough of it to not worry about saving a few additional KBs
of text. Besides, these strings were kind of hard to navigate / edit,
and you could easily forget to regenerate them with scpack (though it
could be automated).
This pragma lets you to enable or disable a specific warning by its
unique number (same as in error messages).
Syntax: #pragma warning (push|pop|enable XXX|disable XXX)
#pragma warning push - save current warnings
#pragma warning pop - restore warnings
#pragma warning enable XXX - enable warning XXX
#pragma warning disable XXX - disable warning XXX