Phase 5: enforce -Werror on our code across the full CI matrix - #4
Merged
Conversation
Turns the warning gate on for the backend builds, not just the portable core: the Linux (ALSA/Pulse/JACK/OSS) and macOS (CoreAudio) CMake builds now pass -DRTAUDIO_WARNINGS_AS_ERRORS=ON, and the MinGW WASAPI/DirectSound builds pass CXXFLAGS=-Werror. These configurations compile only our code (RtAudio.cpp / rtaudio_c.cpp). MinGW ASIO is intentionally left non-fatal because it also compiles the vendored Steinberg ASIO SDK sources, which we do not own. This commit may surface pre-existing -Wextra warnings in the backends; those are fixed in the following commits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
With -Werror enabled on the macOS CoreAudio build, Clang flagged two variable-length arrays (-Wvla-cxx-extension) in RtApiCore: AudioDeviceID ids[ nDevices ]; (probeDevices) AudioValueRange rangeList[ nRanges ]; (probeDeviceInfo) VLAs are non-portable (rejected by MSVC and a Clang/GCC extension in C++). Both are now std::vector, passing .data() to AudioObjectGetPropertyData. Also add -Wvla to the GCC/Clang warning flags so the Linux/Windows builds (GCC does not warn on VLAs under -Wall/-Wextra) guard against future VLAs too. The Linux (ALSA/Pulse/JACK/OSS) and MinGW WASAPI/DirectSound builds already passed -Werror; this was the only backend with findings. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
The newly-added -Wvla flag made GCC flag two variable-length arrays in RtApiAlsa::callbackEvent for the non-interleaved path: void *bufs[channels]; // input (snd_pcm_readn) and output (snd_pcm_writen) Both are now std::vector<void *>, passing .data() to the snd_pcm_*n calls. This confirms -Wvla is doing its job: GCC does not flag VLAs under -Wall/-Wextra, so these were previously invisible on the Linux builds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
Records that warnings-as-errors is now enforced on our code on every platform (Linux/macOS via CMake, MinGW WASAPI/DS via CXXFLAGS), the added -Wvla flag, the four VLAs it surfaced (now fixed), and the ASIO exception. Also removes a stray duplicate section header. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Phase 5 (final hardening pass, follows merged #1/#2/#3): turn
-Werroron for our code across the entire CI matrix, not just the portable core. Tracked inAUDIT.md.All 16 CI jobs pass with the gate enabled.
What changed
-Werroris now enforced on the Linux (ALSA/Pulse/JACK/OSS) and macOS (CoreAudio) CMake builds (RTAUDIO_WARNINGS_AS_ERRORS=ON) and the MinGW WASAPI/DirectSound builds (CXXFLAGS=-Werror). These configs compile only our code. MinGW ASIO is intentionally left non--Werrorbecause it also compiles the vendored Steinberg ASIO SDK sources, which we don't own.-Wvlaadded to the GCC/Clang warning flags so variable-length arrays are rejected on every compiler (GCC doesn't flag them under-Wall/-Wextra; Clang does).-Wall -Wextra):probeDevices/probeDeviceInfo:AudioDeviceID ids[nDevices],AudioValueRange rangeList[nRanges]→std::vector.callbackEvent:void *bufs[channels](read + write paths) →std::vector.Net effect
Combined with the portable
StrictWarningsjob from #1, the fork now builds all of its own code warning-clean under-Wall -Wextra -Wvla -Werroron GCC and Clang across Linux, macOS, and Windows.🤖 Generated with Claude Code
https://claude.ai/code/session_01WHbT36gMxx7WH2tzZfiqUt
Generated by Claude Code