Closed
Description
Issue description:
Warning 204 (symbol is assigned a value that is never used
) only works in simple cases when the variable is unused.
main()
{
new n = 1; // warning 204: symbol is assigned a value that is never used: "n"
}
But if an unused value is assigned after the point where the variable is used, then the compiler won't warn about it:
main()
{
new n = 1;
printf("%d", n);
n = 2; // no warning, even though this assignment is unused
}
Another problem is when the previously assigned value is unused, the compiler doesn't warn about this kind of errors at all:
new x = 1;
x = 2; // again, no warning, even though the previous value (1) is not used
Since the compiler already warns about unused assignments for unused variables, I think it would be beneficial to make it issue warnings in the aforementioned cases as well.
Minimal complete verifiable example (MCVE):
See above.
Workspace Information:
- Compiler version:
- Command line arguments provided (or sampctl version):
- Operating System: