Skip to content

Conversation

5433D-R32433
Copy link

Pull Request Title:
Fix Warnings and Improve Code Quality in stb_image with Enhanced Sanitizers and Compiler Flags


Description:
This PR resolves warnings in stb_image.h by applying stricter compiler flags and sanitizers (UBSan, ASan) for GCC, Clang, MSVC, and TCC to improve stability and debugging.


Changes Made:

  • Signed Conversion Fixes: Fixed signed-to-unsigned conversion issues.
  • Warnings Addressed:
    • -Wconversion, -Wsign-conversion, -Wlogical-op, -Wpedantic, -Wshadow, -Wformat=2, etc.
  • Sanitizer Support:
    • GCC: -fsanitize=undefined,address
    • Clang: -fsanitize=alignment,null,object-size,bounds,enum,float-divide-by-zero,signed-integer-overflow
    • MSVC: /fsanitize=address
    • TCC: Ensured no warnings.

Rationale:

  • Ensures cleaner, more robust code with fewer bugs by catching errors at compile-time and runtime.
  • Improves cross-compiler compatibility and debugging experience.

Testing:

  • Changes tested on GCC, Clang, MSVC, and TCC with no warnings and successful execution.

Checklist:

  • Code compiles cleanly with no warnings.
  • Sanitizers included and working.
  • All tests pass.

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