chore: bump maximum clang tested to 20 (#5692)

This commit is contained in:
Henry Schreiner
2025-05-25 10:54:05 -04:00
committed by GitHub
parent 9d06626521
commit 1dd85ef42a
18 changed files with 57 additions and 35 deletions

View File

@@ -817,7 +817,9 @@ protected:
cast_impl(T &&src, return_value_policy policy, handle parent, index_sequence<Is...>) {
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(src, policy, parent);
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(policy, parent);
std::array<object, size> entries{{reinterpret_steal<object>(
// NOLINTNEXTLINE(bugprone-use-after-move)
make_caster<Ts>::cast(std::get<Is>(std::forward<T>(src)), policy, parent))...}};
for (const auto &entry : entries) {
if (!entry) {

View File

@@ -63,6 +63,9 @@ public:
get_duration(const std::chrono::duration<rep, period> &src) {
return src;
}
static const std::chrono::duration<rep, period> &
get_duration(const std::chrono::duration<rep, period> &&)
= delete;
// If this is a time_point get the time_since_epoch
template <typename Clock>

View File

@@ -273,7 +273,8 @@ struct constructor {
static void execute(Class &cl, const Extra &...extra) {
cl.def(
"__init__",
[](value_and_holder &v_h, Args... args) {
[](value_and_holder &v_h,
Args... args) { // NOLINT(performance-unnecessary-value-param)
v_h.value_ptr() = construct_or_initialize<Cpp<Class>>(std::forward<Args>(args)...);
},
is_new_style_constructor(),

View File

@@ -340,7 +340,7 @@ struct smart_holder {
}
template <typename T>
static smart_holder from_shared_ptr(std::shared_ptr<T> shd_ptr) {
static smart_holder from_shared_ptr(const std::shared_ptr<T> &shd_ptr) {
smart_holder hld;
hld.vptr = std::static_pointer_cast<void>(shd_ptr);
hld.vptr_is_external_shared_ptr = true;

View File

@@ -48,7 +48,7 @@ struct func_wrapper_base {
template <typename Return, typename... Args>
struct func_wrapper : func_wrapper_base {
using func_wrapper_base::func_wrapper_base;
Return operator()(Args... args) const {
Return operator()(Args... args) const { // NOLINT(performance-unnecessary-value-param)
gil_scoped_acquire acq;
// casts the returned object as a rvalue to the return type
return hfunc.f(std::forward<Args>(args)...).template cast<Return>();

View File

@@ -3043,6 +3043,7 @@ template <typename Access,
typename Sentinel,
typename ValueType,
typename... Extra>
// NOLINTNEXTLINE(performance-unnecessary-value-param)
iterator make_iterator_impl(Iterator first, Sentinel last, Extra &&...extra) {
using state = detail::iterator_state<Access, Policy, Iterator, Sentinel, ValueType, Extra...>;
// TODO: state captures only the types of Extra, not the values
@@ -3082,6 +3083,7 @@ template <return_value_policy Policy = return_value_policy::reference_internal,
typename Sentinel,
typename ValueType = typename detail::iterator_access<Iterator>::result_type,
typename... Extra>
// NOLINTNEXTLINE(performance-unnecessary-value-param)
typing::Iterator<ValueType> make_iterator(Iterator first, Sentinel last, Extra &&...extra) {
return detail::make_iterator_impl<detail::iterator_access<Iterator>,
Policy,

View File

@@ -81,7 +81,9 @@ using is_pyobject = std::is_base_of<pyobject_tag, remove_reference_t<T>>;
\endrst */
template <typename Derived>
class object_api : public pyobject_tag {
object_api() = default;
const Derived &derived() const { return static_cast<const Derived &>(*this); }
friend Derived;
public:
/** \rst
@@ -276,7 +278,7 @@ public:
inc_ref_counter(1);
#endif
#ifdef PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
if (m_ptr != nullptr && !PyGILState_Check()) {
if (m_ptr != nullptr && PyGILState_Check() == 0) {
throw_gilstate_error("pybind11::handle::inc_ref()");
}
#endif
@@ -291,7 +293,7 @@ public:
\endrst */
const handle &dec_ref() const & {
#ifdef PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
if (m_ptr != nullptr && !PyGILState_Check()) {
if (m_ptr != nullptr && PyGILState_Check() == 0) {
throw_gilstate_error("pybind11::handle::dec_ref()");
}
#endif

View File

@@ -178,7 +178,7 @@ private:
return true;
}
bool convert_anyset(anyset s, bool convert) {
bool convert_anyset(const anyset &s, bool convert) {
value.clear();
reserve_maybe(s, &value);
return convert_iterable(s, convert);