Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make PYBIND11_WARNING_POP actually pop clang diagnostics #5448

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Commits on Nov 27, 2024

  1. Configuration menu
    Copy the full SHA
    d84c495 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2024

  1. Configuration menu
    Copy the full SHA
    d310959 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1a04f75 View commit details
    Browse the repository at this point in the history
  3. C++20 modernization: Use __VA_OPT__(, ) __VA_ARGS__ in `PYBIND11_DE…

    …CLARE_HOLDER_TYPE()`
    rwgk committed Nov 29, 2024
    Configuration menu
    Copy the full SHA
    98b035a View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2024

  1. Disable __VA_OPT__(, ) __VA_ARGS__ usage for MSVC (it is unclear to…

    … rwgk why it does not work).
    
    This is the beginning of the error message:
    
    ```
             D:\a\pybind11\pybind11\tests\test_smart_ptr.cpp(285,1): error C2143: syntax error: missing ')' before ',' [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
             D:\a\pybind11\pybind11\tests\test_smart_ptr.cpp(285,1): error C2059: syntax error: ')' [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj]
    ```
    rwgk committed Nov 30, 2024
    Configuration menu
    Copy the full SHA
    5c5dc8b View commit details
    Browse the repository at this point in the history
  2. Add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-argume…

    …nts")` in test_smart_ptr.cpp
    
    This is the error message:
    
    ```
    /__w/pybind11/pybind11/tests/test_smart_ptr.cpp:287:51: error: must specify at least one argument for '...' parameter of variadic macro [-Werror,-Wgnu-zero-variadic-macro-arguments]
    PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
                                                      ^
    /__w/pybind11/pybind11/include/pybind11/cast.h:885:13: note: macro 'PYBIND11_DECLARE_HOLDER_TYPE' defined here
                ^
    ```
    rwgk committed Nov 30, 2024
    Configuration menu
    Copy the full SHA
    a575ad6 View commit details
    Browse the repository at this point in the history
  3. Also add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-a…

    …rguments")` in test_virtual_functions.cpp
    rwgk committed Nov 30, 2024
    Configuration menu
    Copy the full SHA
    be2c4cd View commit details
    Browse the repository at this point in the history
  4. Also add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-a…

    …rguments")` in test_embed/test_interpreter.cpp
    rwgk committed Nov 30, 2024
    Configuration menu
    Copy the full SHA
    07859ca View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d01e3ef View commit details
    Browse the repository at this point in the history
  6. 1. Add `PYBIND11_WARNING_DISABLE_CLANG("-Wgnu-zero-variadic-macro-arg…

    …uments")` near the top of pybind11/pybind11.h; 2. Change `PYBIND11_DECLARE_HOLDER_TYPE` macro to side-step the only remaining clang warning-as-error (this is still needed even for clang 18).
    
    Alternatively the warning suppression could be moved into pybind11/cast.h, but this commit limits the warning suppression to smaller scope within include/pybind11.
    rwgk committed Nov 30, 2024
    Configuration menu
    Copy the full SHA
    c9ce487 View commit details
    Browse the repository at this point in the history