| Issue |
167361
|
| Summary |
bogus -Wunused-but-set-variable compiling with clang -DNDEBUG
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
j4reporting
|
this [code](https://github.com/Novum/vkQuake/blob/fbce69c052ac8f7d8571c46ca695d20b5edffecf/Quake/pr_edict.c#L884-L926) 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);`
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs