Skip to content

Scope upstream GpuMat warning suppression to CPU-only GCC builds - #2224

Merged
shimat merged 1 commit into
mainfrom
codex/gpumat-warning-suppression
Nov 22, 2026
Merged

shimat merged 1 commit into
mainfrom
codex/gpumat-warning-suppression

Conversation

@shimat

@shimat shimat commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Treat the CPU-only OpenCV GpuMat diagnostic as a deferred upstream warning: OpenCvSharp does not support CUDA and exposes no managed GpuMat class. No upstream PR is being submitted.

Use the existing OpenCV CMake hook to disable GCC's -Wnonnull only for modules/core/src/cuda_gpu_mat.cpp when CUDA is unavailable. Preserve that file's existing compile options. OpenCV implementation and runtime behavior are unchanged; all other translation units retain nonnull diagnostics.

Refs #2213.

Test plan

  • Compile the unmodified CPU-only production source with GCC 13.4 and -Werror=nonnull: three diagnostics without the hook, zero with it.
  • Inspect generated compile commands: exactly one translation unit receives the suppression; the other 570 do not.
  • Build OpenCV core and OpenCvSharpExtern through their normal CMake targets in an Ubuntu 26.04 CPU-only Release build.
  • Verify production Docker full/slim and manylinux: both Docker jobs, all six native manylinux builds, and both architectures' test jobs pass. All eight native build logs actually recompile GpuMat and contain zero -Wnonnull diagnostics. Docker retains LAPACK in both profiles and MLAS in full, with zero managed test failures.

Summary by CodeRabbit

  • Chores
    • Updated build settings for GNU builds without CUDA to suppress a compiler warning. This change does not alter public interfaces or end-user functionality.

@shimat shimat added the bug Confirmed defect in OpenCvSharp label Nov 21, 2026 — with ChatGPT Codex Connector
@shimat shimat self-assigned this Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CMake hook adds -Wno-nonnull to cuda_gpu_mat.cpp when GNU is used, CUDA is unavailable, and opencv_core exists. It preserves any existing source compile options.

Changes: CMake warning configuration

Layer / File(s) Summary
Set source compile option
cmake/opencv-hooks/POST_FINALIZE.cmake
Under the specified build conditions, the hook appends -Wno-nonnull to the source's existing compile options.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Possibly related issues

  • Issue 2213: The change adds a source-specific suppression for the CPU-only GpuMat warning without globally disabling nonnull diagnostics.
Merge Risk: Minimal · up to c7505

This change only suppresses a GCC warning for one OpenCV source file in CPU-only builds. It does not alter runtime behavior, and other files keep their nonnull diagnostics. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: suppressing the upstream GpuMat warning (GCC -Wnonnull) and limiting that suppression to CPU-only GCC builds. The raw summary confirms the hook adds -Wno-nonnull for c…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: suppressing the upstream GpuMat warning (GCC -Wnonnull) and limiting that suppression to CPU-only GCC builds. The raw summary confirms the hook adds -Wno-nonnull for cuda_gpu_mat.cpp only for GNU builds without CUDA when opencv_core exists. The PR objectives match this scope. The title is specific and accurate.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d6222dd and c75052d.

Files selected for processing: 1

  • cmake/opencv-hooks/POST_FINALIZE.cmake

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@shimat
shimat marked this pull request as ready for review November 22, 2026 01:42
@shimat
shimat merged commit eee9b58 into main Nov 22, 2026
36 checks passed
@shimat
shimat deleted the codex/gpumat-warning-suppression branch November 22, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Confirmed defect in OpenCvSharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant