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

clang 17 compatibility fixes #4767

Merged
merged 3 commits into from
Aug 3, 2023
Merged

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 28, 2023

Description

Resolve new Clang dev C++11 errors:

The CXX compiler identification is Clang 17.0.0
pytypes.h:1615:23: error: identifier '_s' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]
cast.h:1380:26: error: identifier '_a' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator]

Unfortunately gcc 4.8.5 (released June 23, 2015) has the opposite opinion (hard error):

pytypes.h:1615:12: error: missing space between '""' and suffix identifier

All other compilers are fine either way.

When we drop gcc 4.8.5 support the #ifdef clutter can be removed again.

The only GitHub Actions job using gcc 4.8.5 is: 🐍 3 • centos:7 • x64

Suggested changelog entry:

Copy link
Collaborator

@henryiii henryiii left a comment

Choose a reason for hiding this comment

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

Since this doesn't drop anything yet, I'd say it's an easy win.

@rwgk
Copy link
Collaborator Author

rwgk commented Aug 3, 2023

Thanks!

@rwgk rwgk merged commit 17b6143 into pybind:master Aug 3, 2023
85 checks passed
@rwgk rwgk deleted the clang17_compatibility branch August 3, 2023 20:36
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Aug 3, 2023
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Aug 3, 2023
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Aug 4, 2023
* Copy clang 17 compatibility fixes from PR pybind#4762 to a separate PR.

* Add gcc:13 C++20

* Add silkeh/clang:16-bullseye C++20
rwgk pushed a commit that referenced this pull request Aug 8, 2023
…#4772)

* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* static py::exception<> -> static py::handle

* Add `py::set_error()` but also try the suggestion of @malfet (pytorch/pytorch#106401 (review)).

* clang 17 compatibility fixes (#4767)

* Copy clang 17 compatibility fixes from PR #4762 to a separate PR.

* Add gcc:13 C++20

* Add silkeh/clang:16-bullseye C++20

* chore(deps): update pre-commit hooks (#4770)

updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)
- [github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281](astral-sh/ruff-pre-commit@v0.0.276...v0.0.281)
- [github.com/asottile/blacken-docs: 1.14.0 → 1.15.0](adamchainz/blacken-docs@1.14.0...1.15.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools (#4774)

* docs: Remove upper bound on pybind11 in example pyproject.toml for setuptools

* Update docs/compiling.rst

---------

Co-authored-by: Henry Schreiner <[email protected]>

* Provide better type hints for a variety of generic types (#4259)

* Provide better type hints for a variety of generic types

* Makes better documentation
* tuple, dict, list, set, function

* Move to py::typing

* style: pre-commit fixes

* Update copyright line with correct year and actual author. The author information was copy-pasted from the git log output.

---------

Co-authored-by: Ralf W. Grosse-Kunstleve <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Use `py::set_error()` everywhere possible (only one special case, in common.h).
Overload `py::set_error(py::handle, py::handle)`.
Change back to `static py::handle exc = ... .release();`
Deprecate `py::exception<>::operator()`

* Add `PYBIND11_WARNING_DISABLE` for INTEL and MSVC (and sort alphabetically).

* `PYBIND11_WARNING_DISABLE_INTEL(10441)` does not work.

For ICC only, falling back to the recommended `py::set_error()` to keep the testing simple.

It is troublesome to add `--diag-disable=10441` specifically for test_exceptions.cpp, even that is non-ideal because it covers the entire file, not just the one line we need it for, and the value of exercising the trivial deprecated `operator()` on this one extra platform is practically zero.

* Fix silly oversight.

* NVHPC 23.5.0 generates deprecation warnings. They are currently not treated as errors, but falling back to using `py::set_error()` to not have to deal with that distraction.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Keto D. Zhang <[email protected]>
Co-authored-by: Henry Schreiner <[email protected]>
Co-authored-by: Dustin Spicuzza <[email protected]>
hoodmane pushed a commit to pyodide/pyodide that referenced this pull request Nov 14, 2023
Update ContourPy to the latest release, 1.2.0. This uses meson and meson-python to build, and following the recent improvements to meson-based builds here, such as the automagic use of emscripten.meson.cross, this was really easy.

To use pybind11 with clang >= 17 we need pybind/pybind11#4767. This isn't in a pybind11 release yet, so I have included a patch to install pybind11 direct from the github commit that includes the PR. This patch can be removed after the next pybind11 release.
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.

2 participants