Repository navigation
[ML] Do not treat third-party warnings as errors - #3208
Merged
Merged
Conversation
|
Pinging @elastic/ml-core (Team:ML) |
edsavage
force-pushed
the
fix/thirdparty-warning-as-error
branch
from
September 22, 2026 23:20
734f2c5 to
7a48d5e
Compare
edsavage
force-pushed
the
fix/thirdparty-warning-as-error
branch
3 times, most recently
from
September 23, 2026 00:58
7a48d5e to
3671ecd
Compare
ml-cpp applies its strict warning flags (including -Wconversion,
-Wunused-parameter, ...) to every target via
add_compile_options(${ML_CXX_FLAGS}), and the debug Linux CI build enables
CMAKE_COMPILE_WARNING_AS_ERROR=ON (elastic#3198). Once third-party dependencies are
actually compiled from the 3rd_party subtree this breaks the build in two
places:
1. Compiling the third-party sources themselves, whose own warnings are
promoted to errors. Fixed by disabling warnings-as-errors for the
third-party subtree only (matching the existing save/restore pattern),
so their warnings stay visible but non-fatal.
2. Compiling our own targets that include Sandbox2/Abseil/protobuf headers
(MlSandbox and its unit tests). Those headers are pulled in as normal
(-I) includes - deliberately not -isystem, so they stay ahead of
PyTorch's bundled protobuf in the search path - and are not warning-clean
(conversion, unused-parameter, ...). Fixed by turning off
warnings-as-errors on just those consuming targets, which is order-safe
and covers every warning class the third-party headers may trip.
ml-cpp's own code keeps warnings-as-errors everywhere else.
Co-authored-by: Cursor <cursoragent@cursor.com>
edsavage
force-pushed
the
fix/thirdparty-warning-as-error
branch
from
September 23, 2026 01:21
3671ecd to
c1b2d86
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Two moderate findings remain regarding target-wide suppression of warning enforcement.
Review effort: Lite
Findings: None
What changed in this PR
This PR prevents third-party warnings from failing Linux debug builds while preserving strict warning handling elsewhere.
Changes:
- Disable warnings-as-errors for third-party dependencies.
- Disable it for
MlSandboxandml_test_sandbox.
| File | Summary |
|---|---|
lib/sandbox/unittest/CMakeLists.txt |
Disables warning failures for the sandbox test target; this also affects ml-cpp test sources. Moderate finding (1 vote). |
lib/sandbox/CMakeLists.txt |
Disables warning failures for MlSandbox; this also affects ml-cpp production sources. Moderate finding (1 vote). |
3rd_party/CMakeLists.txt |
Disables and restores warnings-as-errors for third-party targets. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
valeriy42
approved these changes
Sep 23, 2026
This was referenced Oct 9, 2026
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.
Summary
The debug Linux CI build (which enables
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON, #3198) fails once third-party dependencies are actually compiled from the3rd_partysubtree. ml-cpp applies its strict warning flags (-Wconversion,-Wunused-parameter, ...) to every target viaadd_compile_options(${ML_CXX_FLAGS}), and these leak into third-party code. This surfaces in two distinct places:MlSandboxand its unit testsml_test_sandbox). Those headers are not warning-clean (conversion,unused-parameter, ...) and, under-Werror, fail the build of our own targets.Fix
Two complementary changes, neither of which weakens linting of ml-cpp's own code:
3rd_party/CMakeLists.txt: disable warnings-as-errors for the third-party subtree only (CMAKE_COMPILE_WARNING_AS_ERROR OFF), matching the block's existing save/restore ofBUILD_TESTING,BUILD_SHARED_LIBS, andCMAKE_UNITY_BUILD. Third-party warnings stay visible but non-fatal.lib/sandbox/CMakeLists.txt+lib/sandbox/unittest/CMakeLists.txt: setCOMPILE_WARNING_AS_ERROR OFFon just the two ml-cpp targets that include third-party sandbox headers. This is order-safe and covers every warning class those headers may trip (rather than chasing individual-Wno-error=<class>flags). All other ml-cpp targets keep-Werror.Why not
SYSTEMincludes?Marking the third-party include directories
SYSTEM(so consumers get-isystem) was tried and rejected: it demotes the vendored protobuf/Abseil source includes from-Ito-isystem, which places them after PyTorch's bundled protobuf in the search path. Protobuf then compiles against a mix of its own generated headers and PyTorch's older protobuf, producing version-mismatch errors (FeatureSetDefaults not declared,PROTOBUF_NODISCARD does not name a type, ...). Keeping the includes as-Iavoids this collision entirely.Test plan
MlSandbox, andml_test_sandboxwithout failing on their warnings.-Wconversionwarnings and the build proceeded past them.)Note: the modified blocks are Linux-only, so this is validated by CI rather than my local macOS build.