Skip to content

Commit f235563

Browse files
committed
fix: some pedantic warnings
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 0b00509 commit f235563

8 files changed

+27
-27
lines changed

tests/test_class_sh_trampoline_shared_ptr_cpp_arg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ std::shared_ptr<SpBase> pass_through_shd_ptr(const std::shared_ptr<SpBase> &obj)
3030

3131
struct PySpBase : SpBase, py::trampoline_self_life_support {
3232
using SpBase::SpBase;
33-
bool is_base_used() override { PYBIND11_OVERRIDE(bool, SpBase, is_base_used); }
33+
bool is_base_used() override { PYBIND11_OVERRIDE(bool, SpBase, is_base_used, ); }
3434
};
3535

3636
struct SpBaseTester {

tests/test_class_sh_trampoline_unique_ptr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ namespace class_sh_trampoline_unique_ptr {
3939
class PyClass : public Class, public py::trampoline_self_life_support {
4040
public:
4141
std::unique_ptr<Class> clone() const override {
42-
PYBIND11_OVERRIDE_PURE(std::unique_ptr<Class>, Class, clone);
42+
PYBIND11_OVERRIDE_PURE(std::unique_ptr<Class>, Class, clone, );
4343
}
4444

45-
int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo); }
45+
int foo() const override { PYBIND11_OVERRIDE_PURE(int, Class, foo, ); }
4646
};
4747

4848
} // namespace class_sh_trampoline_unique_ptr

tests/test_class_sh_virtual_py_cpp_mix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ int get_from_cpp_unique_ptr(std::unique_ptr<Base> b) { return b->get() + 5000; }
3232
struct BaseVirtualOverrider : Base, py::trampoline_self_life_support {
3333
using Base::Base;
3434

35-
int get() const override { PYBIND11_OVERRIDE(int, Base, get); }
35+
int get() const override { PYBIND11_OVERRIDE(int, Base, get, ); }
3636
};
3737

3838
struct CppDerivedVirtualOverrider : CppDerived, py::trampoline_self_life_support {
3939
using CppDerived::CppDerived;
4040

41-
int get() const override { PYBIND11_OVERRIDE(int, CppDerived, get); }
41+
int get() const override { PYBIND11_OVERRIDE(int, CppDerived, get, ); }
4242
};
4343

4444
} // namespace class_sh_virtual_py_cpp_mix

tests/test_cross_module_rtti/bindings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
class BaseTrampoline : public lib::Base, public pybind11::trampoline_self_life_support {
66
public:
77
using lib::Base::Base;
8-
int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get); }
8+
int get() const override { PYBIND11_OVERLOAD(int, lib::Base, get, ); }
99
};
1010

11-
PYBIND11_MODULE(test_cross_module_rtti_bindings, m) {
11+
PYBIND11_MODULE(test_cross_module_rtti_bindings, m, pybind11::mod_gil_not_used()) {
1212
pybind11::classh<lib::Base, BaseTrampoline>(m, "Base")
1313
.def(pybind11::init<int, int>())
1414
.def_readwrite("a", &lib::Base::a)

tests/test_embed/test_interpreter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ class Widget {
4545
class PyWidget final : public Widget {
4646
using Widget::Widget;
4747

48-
int the_answer() const override { PYBIND11_OVERRIDE_PURE(int, Widget, the_answer); }
49-
std::string argv0() const override { PYBIND11_OVERRIDE_PURE(std::string, Widget, argv0); }
48+
int the_answer() const override { PYBIND11_OVERRIDE_PURE(int, Widget, the_answer, ); }
49+
std::string argv0() const override { PYBIND11_OVERRIDE_PURE(std::string, Widget, argv0, ); }
5050
};
5151

5252
class test_override_cache_helper {
@@ -62,7 +62,7 @@ class test_override_cache_helper {
6262
};
6363

6464
class test_override_cache_helper_trampoline : public test_override_cache_helper {
65-
int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func); }
65+
int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func, ); }
6666
};
6767

6868
PYBIND11_EMBEDDED_MODULE(widget_module, m, py::multiple_interpreters::per_interpreter_gil()) {

tests/test_potentially_slicing_weak_ptr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ const char *determine_trampoline_state(const std::shared_ptr<VB> &sp) {
5656

5757
struct PyVirtBaseSH : VirtBaseSH, py::trampoline_self_life_support, trampoline_is_alive_simple {
5858
using VirtBaseSH::VirtBaseSH;
59-
int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSH, get_code); }
59+
int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSH, get_code, ); }
6060
};
6161

6262
struct PyVirtBaseSP : VirtBaseSP, trampoline_is_alive_simple { // self-life-support not available
6363
using VirtBaseSP::VirtBaseSP;
64-
int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSP, get_code); }
64+
int get_code() override { PYBIND11_OVERRIDE(int, VirtBaseSP, get_code, ); }
6565
};
6666

6767
template <typename VB>

tests/test_smart_ptr.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,11 @@ struct holder_helper<ref<T>> {
313313
PYBIND11_DECLARE_HOLDER_TYPE(T, ref<T>, true)
314314
PYBIND11_DECLARE_HOLDER_TYPE(T, const_only_shared_ptr<T>, true)
315315
// The following is not required anymore for std::shared_ptr, but it should compile without error:
316-
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>)
317-
PYBIND11_DECLARE_HOLDER_TYPE(T, huge_unique_ptr<T>)
318-
PYBIND11_DECLARE_HOLDER_TYPE(T, custom_unique_ptr<T>)
319-
PYBIND11_DECLARE_HOLDER_TYPE(T, shared_ptr_with_addressof_operator<T>)
320-
PYBIND11_DECLARE_HOLDER_TYPE(T, unique_ptr_with_addressof_operator<T>)
316+
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr<T>, )
317+
PYBIND11_DECLARE_HOLDER_TYPE(T, huge_unique_ptr<T>, )
318+
PYBIND11_DECLARE_HOLDER_TYPE(T, custom_unique_ptr<T>, )
319+
PYBIND11_DECLARE_HOLDER_TYPE(T, shared_ptr_with_addressof_operator<T>, )
320+
PYBIND11_DECLARE_HOLDER_TYPE(T, unique_ptr_with_addressof_operator<T>, )
321321

322322
namespace holder_caster_traits_test {
323323
struct example_base {};

tests/test_virtual_functions.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class NCVirt {
145145
class NCVirtTrampoline : public NCVirt {
146146
#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__) && !defined(__PGIC__)
147147
NonCopyable get_noncopyable(int a, int b) override {
148-
PYBIND11_OVERRIDE(NonCopyable, NCVirt, get_noncopyable, a, b);
148+
PYBIND11_OVERRIDE(NonCopyable, NCVirt, get_noncopyable, a, b, );
149149
}
150150
#endif
151151
Movable get_movable(int a, int b) override {
@@ -220,7 +220,7 @@ class test_override_cache_helper {
220220
};
221221

222222
class test_override_cache_helper_trampoline : public test_override_cache_helper {
223-
int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func); }
223+
int func() override { PYBIND11_OVERRIDE(int, test_override_cache_helper, func, ); }
224224
};
225225

226226
inline int test_override_cache(std::shared_ptr<test_override_cache_helper> const &instance) {
@@ -280,7 +280,7 @@ TEST_SUBMODULE(virtual_functions, m) {
280280
py::print("PyA.f()");
281281
// This convolution just gives a `void`, but tests that PYBIND11_TYPE() works to
282282
// protect a type containing a ,
283-
PYBIND11_OVERRIDE(PYBIND11_TYPE(typename std::enable_if<true, void>::type), A, f);
283+
PYBIND11_OVERRIDE(PYBIND11_TYPE(typename std::enable_if<true, void>::type), A, f, );
284284
}
285285
};
286286

@@ -303,7 +303,7 @@ TEST_SUBMODULE(virtual_functions, m) {
303303
~PyA2() override { py::print("PyA2.~PyA2()"); }
304304
void f() override {
305305
py::print("PyA2.f()");
306-
PYBIND11_OVERRIDE(void, A2, f);
306+
PYBIND11_OVERRIDE(void, A2, f, );
307307
}
308308
};
309309

@@ -371,26 +371,26 @@ TEST_SUBMODULE(virtual_functions, m) {
371371
public:
372372
using OverrideTest::OverrideTest;
373373
std::string str_value() override {
374-
PYBIND11_OVERRIDE(std::string, OverrideTest, str_value);
374+
PYBIND11_OVERRIDE(std::string, OverrideTest, str_value, );
375375
}
376376
// Not allowed (enabling the below should hit a static_assert failure): we can't get a
377377
// reference to a python numeric value, since we only copy values in the numeric type
378378
// caster:
379379
#ifdef PYBIND11_NEVER_DEFINED_EVER
380380
std::string &str_ref() override {
381-
PYBIND11_OVERRIDE(std::string &, OverrideTest, str_ref);
381+
PYBIND11_OVERRIDE(std::string &, OverrideTest, str_ref, );
382382
}
383383
#endif
384384
// But we can work around it like this:
385385
private:
386386
std::string _tmp;
387-
std::string str_ref_helper() { PYBIND11_OVERRIDE(std::string, OverrideTest, str_ref); }
387+
std::string str_ref_helper() { PYBIND11_OVERRIDE(std::string, OverrideTest, str_ref, ); }
388388

389389
public:
390390
std::string &str_ref() override { return _tmp = str_ref_helper(); }
391391

392-
A A_value() override { PYBIND11_OVERRIDE(A, OverrideTest, A_value); }
393-
A &A_ref() override { PYBIND11_OVERRIDE(A &, OverrideTest, A_ref); }
392+
A A_value() override { PYBIND11_OVERRIDE(A, OverrideTest, A_value, ); }
393+
A &A_ref() override { PYBIND11_OVERRIDE(A &, OverrideTest, A_ref, ); }
394394
};
395395

396396
py::class_<OverrideTest::A>(m, "OverrideTest_A")
@@ -502,7 +502,7 @@ class PyC_Repeat : public C_Repeat {
502502
std::string say_something(unsigned times) override {
503503
PYBIND11_OVERRIDE(std::string, C_Repeat, say_something, times);
504504
}
505-
double lucky_number() override { PYBIND11_OVERRIDE(double, C_Repeat, lucky_number, ); }
505+
double lucky_number() override { PYBIND11_OVERRIDE(double, C_Repeat, lucky_number); }
506506
};
507507
class PyD_Repeat : public D_Repeat {
508508
public:

0 commit comments

Comments
 (0)