Fix gcc compiler warnings (#5523)

* CI: Fail on any warnings with clang 18

* CI: Fail on any warnings with gcc 13

* Fix cmake's try_compile warning

* Guard redundant declarations

* ci.yml: fix syntax error

* Use PYBIND11_WARNING macros

* Fix more redundant declarations

... introduced with merge of smart_holder branch
This commit is contained in:
Robert Haschke
2025-04-30 19:29:00 +02:00
committed by GitHub
parent d3fee42905
commit c7f3460f18
6 changed files with 23 additions and 8 deletions

View File

@@ -199,7 +199,7 @@ jobs:
run: |
uv pip install --python=python --system setuptools
pytest tests/extra_setuptools
if: "!(matrix.runs-on == 'windows-2022')"
if: matrix.runs-on != 'windows-2022'
manylinux:
name: Manylinux on 🐍 3.13t • GIL
@@ -330,9 +330,10 @@ jobs:
container_suffix: "-bullseye"
- clang: 18
std: 20
cxx_flags: "-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls"
container_suffix: "-bookworm"
name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64"
name: "🐍 3 • Clang ${{ matrix.clang }} • C++${{ matrix.std }} • x64${{ matrix.cxx_flags && ' • cxx_flags' || '' }}"
container: "silkeh/clang:${{ matrix.clang }}${{ matrix.container_suffix }}"
steps:
@@ -348,6 +349,7 @@ jobs:
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
- name: Build
@@ -491,9 +493,9 @@ jobs:
- { gcc: 9, std: 20 }
- { gcc: 10, std: 17 }
- { gcc: 10, std: 20 }
- { gcc: 13, std: 20 }
- { gcc: 13, std: 20, cxx_flags: "-Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls" }
name: "🐍 3 • GCC ${{ matrix.gcc }} • C++${{ matrix.std }}• x64"
name: "🐍 3 • GCC ${{ matrix.gcc }} • C++${{ matrix.std }} • x64${{ matrix.cxx_flags && ' • cxx_flags' || '' }}"
container: "gcc:${{ matrix.gcc }}"
steps:
@@ -515,6 +517,7 @@ jobs:
-DPYBIND11_WERROR=ON
-DDOWNLOAD_CATCH=ON
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
-DCMAKE_CXX_FLAGS="${{ matrix.cxx_flags }}"
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
- name: Build