Skip to content

gcc16 warning patch on pybind#1131

Merged
cliffburdick merged 1 commit intomainfrom
cliffburdick-patch-2
Mar 3, 2026
Merged

gcc16 warning patch on pybind#1131
cliffburdick merged 1 commit intomainfrom
cliffburdick-patch-2

Conversation

@cliffburdick
Copy link
Collaborator

No description provided.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR patches a GCC 16 compiler warning by wrapping the pybind11/embed.h and pybind11/numpy.h includes in pybind.h with the existing MATX_IGNORE_WARNING_PUSH_GCC/MATX_IGNORE_WARNING_POP_GCC macros to suppress -Wnull-dereference false positives.

  • The macros are defined in defines.h and are no-ops for Clang and other non-GCC compilers, so there is no impact on non-GCC builds.
  • The pattern is consistent with at least a dozen other sites in the codebase (e.g., tensor_impl.h, svd_lapack.h, einsum.h, etc.) that suppress other GCC-specific warnings the same way.
  • The suppression scope is correctly minimal — only the two pybind11 headers are wrapped, while the subsequent standard-library includes (<optional>, <filesystem>) are intentionally left outside the suppressed range.
  • defines.h is guaranteed to be included before this code executes because pybind.h includes matx/core/type_utils.hmatx/core/half.hmatx/core/defines.h at the top of the file.

Confidence Score: 5/5

  • This PR is safe to merge — it is a minimal, targeted warning-suppression patch with no functional changes.
  • The change is two lines added and uses a macro pattern already proven correct in more than a dozen locations across the codebase. It is a no-op on Clang and other non-GCC compilers, the macro definitions are already in scope, and the scope of suppression is the tightest possible (only the two pybind11 headers). No logic, interface, or data is modified.
  • No files require special attention.

Important Files Changed

Filename Overview
include/matx/core/pybind.h Wraps pybind11 includes with GCC-specific -Wnull-dereference warning suppression macros, using an already well-established pattern throughout the codebase.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["pybind.h included"] --> B{"MATX_ENABLE_PYBIND11\ndefined?"}
    B -- No --> Z["No pybind11 code compiled"]
    B -- Yes --> C["MATX_IGNORE_WARNING_PUSH_GCC\n('-Wnull-dereference')"]
    C --> D{"Compiler?"}
    D -- "GCC" --> E["_Pragma: GCC diagnostic push\n_Pragma: GCC diagnostic ignored -Wnull-dereference"]
    D -- "Clang / other" --> F["No-op (macro expands to nothing)"]
    E --> G["#include pybind11/embed.h\n#include pybind11/numpy.h"]
    F --> G
    G --> H["MATX_IGNORE_WARNING_POP_GCC"]
    H --> I{"Compiler?"}
    I -- "GCC" --> J["_Pragma: GCC diagnostic pop\n(restores previous warning state)"]
    I -- "Clang / other" --> K["No-op"]
    J --> L["#include optional\n#include filesystem\n(no suppression)"]
    K --> L
Loading

Last reviewed commit: 4817f0a

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@cliffburdick
Copy link
Collaborator Author

/build

@cliffburdick cliffburdick merged commit 5fd8dbb into main Mar 3, 2026
1 check passed
@cliffburdick cliffburdick deleted the cliffburdick-patch-2 branch March 3, 2026 16:20
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