Skip to content

ci: treat warnings as errors - #181

Merged
jpnurmi merged 4 commits into
getsentryfrom
jpnurmi/ci/error-on-warnings
Nov 20, 2026
Merged

jpnurmi merged 4 commits into
getsentryfrom
jpnurmi/ci/error-on-warnings

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Stop forcing /WX on users who include crashpad in their builds, so that new compiler warnings do not break their builds. CI enables CMAKE_COMPILE_WARNING_AS_ERROR instead to keep the code free of warnings.

Build with -Wall on non-MSVC compilers to match /W4 on MSVC, and fix the resulting warnings:

GCC:

util/stream/zlib_output_stream.cc:39:8: error: suggest explicit braces to avoid ambiguous ‘else’ [-Werror=dangling-else]
client/crashpad_client_linux.cc:601:31: error: passing argument 2 to ‘restrict’-qualified parameter aliases with argument 1 [-Werror=restrict]
client/settings.cc:216:9: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct crashpad::SettingsReader::Data’; use assignment or value-initialization instead [-Werror=class-memaccess]

macOS:

snapshot/mac/process_reader_mac.cc:97:7: error: field 'process_memory_' will be initialized after field 'task_' [-Werror,-Wreorder-ctor]
third_party/mini_chromium/mini_chromium/base/apple/bridging.h:112:1: error: '__bridge_transfer' casts have no effect when not using ARC [-Werror,-Warc-bridge-casts-disallowed-in-nonarc]

clang-cl:

tools\generate_dump.cc(228,11): error : 'unlink' is deprecated: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _unlink. See online help for details. [-Werror,-Wdeprecated-declarations]

MinGW:

third_party/mini_chromium/mini_chromium/base/threading/thread_local_storage_win.cc:51:9: error: unknown pragma ignored [-Werror,-Wunknown-pragmas]
client/crashpad_info.cc:101:9: warning: unknown pragma ignored [-Wunknown-pragmas]
client/crashpad_info.cc:102:12: warning: unknown attribute 'allocate' ignored [-Wunknown-attributes]

MinGW arm64 (util/misc/capture_context_win_arm64.S):

<command line>:11:9: error: redefining builtin macro [-Werror,-Wbuiltin-macro-redefined]

The vendored libunwind in the macOS stack-trace build is excluded from warnings as errors:

libunwind/src/config.h:194:25: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]

Stop forcing `/WX` on users who build crashpad, so that new compiler
warnings do not break their builds. CI enables
`CMAKE_COMPILE_WARNING_AS_ERROR` instead to keep the code free of
warnings.

Build with `-Wall` on non-MSVC compilers to match `/W4` on MSVC.
- `-Wdangling-else` in `ZlibOutputStream`
- `-Wrestrict` from passing the same `stack_t` to `sigaltstack()`
- `-Wclass-memaccess` from clearing `SettingsReader::Data`
- `-Wreorder-ctor` in `ProcessReaderMac`
- ARC bridging casts in `on_demand_service_tool`
- deprecated `unlink()` in `crashpad_generate_dump` with clang-cl
MinGW ignores `#pragma section` and `__declspec(allocate)`, so the
handler could not find `CrashpadInfo` and ignored its settings, such
as `limit_stack_capture_to_sp`. Use the GNU `section` attribute
instead.
@jpnurmi
jpnurmi force-pushed the jpnurmi/ci/error-on-warnings branch from 817cfb8 to ce3b331 Compare November 20, 2026 09:39
The arm64 assembly is preprocessed as C, where the definition
redefines a builtin macro:

    <command line>:11:9: error: redefining builtin macro [-Werror,-Wbuiltin-macro-redefined]

Ref: https://github.com/getsentry/crashpad/actions/runs/44712564858/job/136207676046
@jpnurmi
jpnurmi merged commit bc334ef into getsentry Nov 20, 2026
27 checks passed
@jpnurmi
jpnurmi deleted the jpnurmi/ci/error-on-warnings branch November 20, 2026 12:43
jpnurmi added a commit to getsentry/sentry-native that referenced this pull request Nov 20, 2026
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