py: Fix include order
Python.h hence the pybind header must be included first since pyconfig.h unconditionally overrides certain feature test macros[0]. This was mostly hidden by the fact that macro redefinitions with the same value do not trigger compiler warnings. However, glibc 43 has changed certain defaults[1], causing mismatches, leading to compiler warnings. So change the include order so that `<pybind11/...>` headers are included first and then the local `"py_..."` headers, and then everything else. Also remove some redundant includes. Adjust `.clang-format` and the documentation as well. [0]: https://docs.python.org/3/c-api/intro.html#include-files [1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=a5cc3018f31a125f019685b239c6e5a0bf1a272b Link: https://github.com/python/cpython/issues/61322 Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
@@ -95,6 +95,12 @@ System and library headers shall be included with angle brackets. Project
|
||||
headers shall be included with angle brackets for the libcamera public API
|
||||
headers, and with double quotes for internal libcamera headers.
|
||||
|
||||
.. note::
|
||||
As an exception pybind11 headers and local ``py_*`` headers must be included first
|
||||
in the Python bindings due to the requirements outlined in the `Python documentation`_.
|
||||
|
||||
.. _Python documentation: https://docs.python.org/3/c-api/intro.html#include-files
|
||||
|
||||
|
||||
C++ Specific Rules
|
||||
------------------
|
||||
|
||||
Reference in New Issue
Block a user