-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Another warning 240 false positive. #669
Comments
#pragma unused end Doesn't seem to bypass the warning. I think it should. |
OK, I think the first one for |
Of course it wouldn't, you're using it when the warning is already printed. It should work if you place it before the assignment though. And regarding that false-positive, I'll look into it |
MCVE: main()
{
for (new x = 5; --x != 0;)
{
if (x == 2)
{
x = 1;
goto lbl_cont;
}
x = 3; // false-positive warning 240
lbl_cont:
}
} Replacing |
Putting it before makes sense. But maybe the message could be improved a bit, because I merged the PR and keep getting caught out. The problem is: h = 5;
h = 5; // Warning is here. The warning reads like that second value is the one written and never read, whereas the warning comes when the unread value is clobbered. I understand why, it's just a bit confusing right now. |
If I do that, then, for example, if we have this code: main()
{
new var1 = 1; // warning 240: assigned value is never used
new var2 = sizeof(var1); // warning 223: redundant "sizeof": argument size is always 1
var1 = 2;
#pragma unused var1, var2
} the compiler would print warning 240 after warning 223, although the unused assignment happens before the redundant use of |
This issue has been automatically marked as stale because it has not had recent activity. |
Issue description:
@Daniel-Cortez
https://github.com/pawn-lang/YSI-Includes/blob/cb8a4cd99776b99b0c07933d0be29828c2199a8b/YSI_Storage/y_ini/y_ini_impl.inc#L990
The compiler reports this instance of
end
as never read, but it might be, depending on what is executed in the loop. It is entirely possible to exit the loop without reassigningend
.There's also a different false positive here:
https://github.com/pawn-lang/YSI-Includes/blob/cb8a4cd99776b99b0c07933d0be29828c2199a8b/YSI_Storage/y_ini/y_ini_impl.inc#L1427
handle
is assigned at the end of thecase
statement, but again this is within a loop and it can be used on later iterations.Minimal complete verifiable example (MCVE):
Workspace Information:
The text was updated successfully, but these errors were encountered: