-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed as not planned
Closed as not planned
Copy link
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
this code generates a warning when compiled with clang and -DNDEBUG
pr_edict.c:886:6: error: variable 'free_edicts_count' set but not used [-Werror,-Wunused-but-set-variable]
886 | int free_edicts_count = 0;
| ^
../Quake/pr_edict.c:887:6: error: variable 'free_list_count' set but not used [-Werror,-Wunused-but-set-variable]
887 | int free_list_count = 0;
| ^
2 errors generated.
changing
free_edicts_count++; to free_edicts_count = free_edicts_count + 1;
free_list_count++; to free_list_count = free_list_count +1;
prevents the warning.
compiling w/o -DNDEBUG prevents the warning because of the assert in line 921
assert (free_list_count == free_edicts_count);
Metadata
Metadata
Assignees
Labels
clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!