Skip to content

build: apply SENTRY_ERROR_ON_WARNINGS to MSVC, breakpad and crashpad - #2315

Open
jpnurmi wants to merge 7 commits into
v1from
jpnurmi/build/external-error-on-warnings
Open

jpnurmi wants to merge 7 commits into
v1from
jpnurmi/build/external-error-on-warnings

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

SENTRY_ERROR_ON_WARNINGS now also adds /WX on MSVC, and applies to breakpad, crashpad and sentry-crash in addition to sentry itself. Breakpad builds with /W3 or -Wall, and crashpad with /W4 or -Wall, depending on the compiler used. Sentry-crash builds with the same options as sentry, now on MSVC too.

Also fixes the clang-cl build with VS 2026, and adds a ClangCL CI job for it:

include\sentry.h(955,11): error: identifier 'wchar_t' conflicts with a C++ keyword [-Werror,-Wc++-keyword]
src\sentry_attachment.c(233,12): error: not eliding copy on return [-Werror,-Wnrvo]
src\backends\sentry_backend_inproc.c(147,31): error: padding struct 'struct sentry_inproc_backend_config_s' with 3 bytes to align 'handler_strategy' [-Werror,-Wpadded]

See also:

@jpnurmi jpnurmi closed this Nov 18, 2026
@jpnurmi

jpnurmi commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by getsentry/crashpad#181

Build breakpad with `/W3` on MSVC and `-Wall` elsewhere, and treat
breakpad's and crashpad's warnings as errors with
`SENTRY_ERROR_ON_WARNINGS`.

Bump breakpad and crashpad to fix their warnings.
@jpnurmi
jpnurmi force-pushed the jpnurmi/build/external-error-on-warnings branch from ba7464e to cfddf39 Compare November 20, 2026 11:14
Add `/WX` to sentry, crashpad and breakpad when the option is
enabled, like `-Werror` on other compilers.
@jpnurmi jpnurmi changed the title build: apply SENTRY_ERROR_ON_WARNINGS to breakpad and crashpad build: apply SENTRY_ERROR_ON_WARNINGS to MSVC, breakpad and crashpad Nov 20, 2026
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.78%. Comparing base (87c2032) to head (da0cbbd).

Additional details and impacted files
@@            Coverage Diff             @@
##               v1    #2315      +/-   ##
==========================================
+ Coverage   75.72%   75.78%   +0.06%     
==========================================
  Files         105      105              
  Lines       30936    30936              
  Branches     5775     5775              
==========================================
+ Hits        23426    23445      +19     
+ Misses       6075     6054      -21     
- Partials     1435     1437       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jpnurmi
jpnurmi marked this pull request as ready for review November 20, 2026 12:08

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3831d9d. Configure here.

Comment thread CMakeLists.txt Resolved
clang-cl maps `-Wall` to `-Weverything`, so the warnings that clang 21
added fail the `sentry` build with the clang-cl 22.1.3 that ships with
Visual Studio 2026.

```text
include\sentry.h(955,11): error: identifier 'wchar_t' conflicts with a C++ keyword [-Werror,-Wc++-keyword]
src\sentry_attachment.c(233,12): error: not eliding copy on return [-Werror,-Wnrvo]
src\backends\sentry_backend_inproc.c(147,31): error: padding struct 'struct sentry_inproc_backend_config_s' with 3 bytes to align 'handler_strategy' [-Werror,-Wpadded]
```
`sentry-crash` copied the warning options from `sentry` only on GCC and
Clang, so `SENTRY_ERROR_ON_WARNINGS` did not reach the daemon on MSVC.

Ref: #2315 (comment)
Run the ClangCL build and tests on `windows-2025-vs2026` as well, which
ships a newer clang-cl than VS 2022. Let CMake pick the installed Visual
Studio instead of forcing the VS 2022 generator.
clang-cl always built `sentry` with `-Werror`, so each new clang-cl
warning broke the build for everyone. Leave it to the `/WX` that
`SENTRY_ERROR_ON_WARNINGS` adds.

This branch has not been deployed

No deployments
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