From f99efeac7c60110d5074d2bdefd2715aa840eb4e Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Sat, 18 Jun 2022 15:57:54 -0400 Subject: [PATCH 1/5] Use equals default in pyobject macros --- include/pybind11/pytypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/pybind11/pytypes.h b/include/pybind11/pytypes.h index f9625e77ea..f5c8d40457 100644 --- a/include/pybind11/pytypes.h +++ b/include/pybind11/pytypes.h @@ -1247,7 +1247,7 @@ public: #define PYBIND11_OBJECT_CVT_DEFAULT(Name, Parent, CheckFun, ConvertFun) \ PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \ - Name() : Parent() {} + Name() = default; #define PYBIND11_OBJECT_CHECK_FAILED(Name, o_ptr) \ ::pybind11::type_error("Object of type '" \ @@ -1270,7 +1270,7 @@ public: #define PYBIND11_OBJECT_DEFAULT(Name, Parent, CheckFun) \ PYBIND11_OBJECT(Name, Parent, CheckFun) \ - Name() : Parent() {} + Name() = default; /// \addtogroup pytypes /// @{ From b23a34ef07065b046f3aa6455e80d8f1f5c9f302 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 20 Jul 2022 10:58:05 -0400 Subject: [PATCH 2/5] Remove extra semicolon --- include/pybind11/numpy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 0291b02d0b..4f82f1ec3f 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -537,7 +537,7 @@ PYBIND11_NAMESPACE_END(detail) class dtype : public object { public: - PYBIND11_OBJECT_DEFAULT(dtype, object, detail::npy_api::get().PyArrayDescr_Check_); + PYBIND11_OBJECT_DEFAULT(dtype, object, detail::npy_api::get().PyArrayDescr_Check_) explicit dtype(const buffer_info &info) { dtype descr(_dtype_from_pep3118()(pybind11::str(info.format))); From f0a745b5bb3499da22a0001cbfab906c2315e9cc Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 20 Jul 2022 11:03:49 -0400 Subject: [PATCH 3/5] Update clang-tidy equals-default rule to not ignore macros --- .clang-tidy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.clang-tidy b/.clang-tidy index d945a4a27d..a935cb18f0 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -63,6 +63,8 @@ Checks: | -bugprone-unused-raii, CheckOptions: +- key: modernize-use-equals-default.IgnoreMacros + value: false - key: performance-for-range-copy.WarnOnAllAutoCopies value: true - key: performance-inefficient-string-concatenation.StrictMode From e5caefaafe84d261d8c20554a6700cfd8633afdb Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 20 Jul 2022 11:05:01 -0400 Subject: [PATCH 4/5] Fix formatting --- .clang-tidy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index a935cb18f0..09d57819c3 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -63,8 +63,8 @@ Checks: | -bugprone-unused-raii, CheckOptions: -- key: modernize-use-equals-default.IgnoreMacros - value: false +- key: modernize-use-equals-default.IgnoreMacros + value: false - key: performance-for-range-copy.WarnOnAllAutoCopies value: true - key: performance-inefficient-string-concatenation.StrictMode From f39b66a8330c8603c48fb2dcebe9d9a3dee830ea Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Wed, 20 Jul 2022 11:21:22 -0400 Subject: [PATCH 5/5] One last formatting change --- .clang-tidy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index 09d57819c3..23018386c1 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -63,7 +63,7 @@ Checks: | -bugprone-unused-raii, CheckOptions: -- key: modernize-use-equals-default.IgnoreMacros +- key: modernize-use-equals-default.IgnoreMacros value: false - key: performance-for-range-copy.WarnOnAllAutoCopies value: true