Skip to content

Clang warning fixes #708

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

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft

Clang warning fixes #708

wants to merge 24 commits into from

Conversation

Lgt2x
Copy link
Member

@Lgt2x Lgt2x commented May 21, 2025

Description

Resolve a bunch of clang warnings. The core of the leftover warnings are "unused-X" that need evaluation, char subscripts and C++ function signatures exported with C linkage.

For removed code, I kept relevant logic when it made sense, while keeping execution logic unchanged.

Lgt2x added 24 commits May 20, 2025 18:44
These pragmas were not useful or considered by any compilre, so we can safely remove them now.
Initialize variables that may not be assigned before being used
Using a pragma message here is not very useful
Comment single values following an expression, that may or may not be part of it.
Remove unused but set variables, keep code when it makes sense
Add a missing const qualifier in parent class
Remove test if it does not make sens or is indeed trivial, fix it by changing variable type when it makes sense
RAND_MAX+1 overflows, so divide by RAND_MAX
use std::cout instead of fprintf, treat string as an argument in snprintf
use value 32767 instead of 65535 for undefined to fit a short
@Lgt2x Lgt2x marked this pull request as draft May 21, 2025 18:41
@@ -523,7 +523,7 @@ void DemoCheats(int key) {

int i;
for (i = 0; i < MAX_PLAYER_WEAPONS; i++) {
if (HAS_FLAG(i)) {
if (HAS_FLAG(i) != 0) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at it again this test makes no sense, may as well remove it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant