Skip to content

Suppress the Clang warning -Wsign-conversion - #142

Merged
Yaraslaut merged 2 commits into
contour-terminal:masterfrom
YexuanXiao:patch-3
Aug 23, 2026
Merged

Yaraslaut merged 2 commits into
contour-terminal:masterfrom
YexuanXiao:patch-3

Conversation

@YexuanXiao

@YexuanXiao YexuanXiao commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

…g -Wsign-conversion.

@Yaraslaut Yaraslaut left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the fix, I think that we should make sure to check via clang-tidy and also turn warnings as errors for such cases and fix them, otherwise we will have them again. Can you please ensure that in the CI we catch all such instances?

@YexuanXiao

YexuanXiao commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor Author

I just realized this is due to my patch #131. The original code assumed GCC, so MSVC would emit warnings about unrecognized pragmas. My patch changed it so the warning is only enabled when __GNUC__ is defined (Clang in GNU mode also defines __GNUC__). But this causes ClangCL to trigger -Wsign-conversion warnings, since ClangCL doesn't define __GNUC__ but still generates the warning.
I think there are two options right now:

  1. Remove
    #ifdef __GNUC__
    #pragma GCC diagnostic ignored "-Wsign-conversion"
    #endif
    , because the current patch already suppresses the warning.
  2. Revert that patch and change
    #ifdef __GNUC__
    #pragma GCC diagnostic ignored "-Wsign-conversion"
    #endif
    to #if defined(__GNUC__) || defined(__clang__).

Also, maybe we should add a ClangCL CI.

@YexuanXiao
YexuanXiao requested a review from Yaraslaut August 22, 2026 08:08
@Yaraslaut

Copy link
Copy Markdown
Member

@YexuanXiao agree that we should add a clang-cl to the CI, and clang-tidy as well to make sure that we simple fix such issues in the codebase

@YexuanXiao YexuanXiao changed the title Explicitly cast the value to unsigned int to silence the clang warnin… Suppress the Clang warning -Wsign-conversion Aug 22, 2026
@codecov

codecov Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.11%. Comparing base (41aef51) to head (592f606).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
- Coverage   88.50%   88.11%   -0.40%     
==========================================
  Files          37       37              
  Lines        1792     1792              
==========================================
- Hits         1586     1579       -7     
- Misses        206      213       +7     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Yaraslaut
Yaraslaut enabled auto-merge August 23, 2026 06:37
@Yaraslaut
Yaraslaut merged commit 0cf7a3b into contour-terminal:master Aug 23, 2026
13 of 14 checks passed
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.

3 participants