Skip to content

Resolved multiple -Wsign-compare warnings#3304

Draft
SAN4EZDREAMS wants to merge 10 commits intoZDoom:masterfrom
SAN4EZDREAMS:warning-comparison-of-integer
Draft

Resolved multiple -Wsign-compare warnings#3304
SAN4EZDREAMS wants to merge 10 commits intoZDoom:masterfrom
SAN4EZDREAMS:warning-comparison-of-integer

Conversation

@SAN4EZDREAMS
Copy link
Contributor

Fixes numerous signed/unsigned comparison warnings reported by recent GCC versions across the code.
Changes involve explicit type casting to ensure safe comparisons without altering the original logic.

Exception (third-party library):

/home/runner/work/gzdoom/gzdoom/src/common/thirdparty/stb/stb_sprintf.h:630:51: warning: operand of ‘?:’ changes signedness from ‘int’ to ‘unsigned int’ due to unsignedness of other operand [-Wsign-compare]
  630 |          l = stbsp__strlen_limited(s, (pr >= 0) ? pr : ~0u);
      |                                                   ^~

@SAN4EZDREAMS SAN4EZDREAMS force-pushed the warning-comparison-of-integer branch from d4e503c to 7e6f1c5 Compare August 11, 2025 15:57
@RicardoLuis0
Copy link
Contributor

the fix to this isn't casting everywhere, that just hides the warnings, it's to change indices/etc to the proper sign where possible

@SAN4EZDREAMS SAN4EZDREAMS marked this pull request as draft August 12, 2025 17:07
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.

2 participants