Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnostics for detection of endless loops #634

Merged
merged 11 commits into from
May 2, 2021
Prev Previous commit
Next Next commit
Update tests
  • Loading branch information
Daniel-Cortez committed May 2, 2021
commit 59c6de121841ab9623fbeb658570e9d5d0e0ace5
9 changes: 6 additions & 3 deletions source/compiler/tests/warning_250_251.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ main()
while(fread(f,line,sizeof(line),false) < m) {} // shouldn't warn about "f" or "m" not being modified
fclose(f);

// Case 12: Warnings 250 and 251 don't work for global variables (yet?)
while (glbvar < 10) {}
for (glbvar = 0; glbvar < 10; ) {}
// Case 12: Warnings 250 and 251 shouldn't trigger when at least one global
// variable is used inside the loop condition, as globals can be modified
// from a function called from the loop body and currently there's no easy
// way to track this.
while (n < glbvar) {}
for (new i = 0; i < glbvar; ) {}
}