Skip to content

Commit 42b5450

Browse files
authored
chore: use explicit defaulting in pyobject macros (#4017)
* Use equals default in pyobject macros * Remove extra semicolon * Update clang-tidy equals-default rule to not ignore macros * Fix formatting * One last formatting change
1 parent f47f1ed commit 42b5450

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.clang-tidy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Checks: |
6363
-bugprone-unused-raii,
6464
6565
CheckOptions:
66+
- key: modernize-use-equals-default.IgnoreMacros
67+
value: false
6668
- key: performance-for-range-copy.WarnOnAllAutoCopies
6769
value: true
6870
- key: performance-inefficient-string-concatenation.StrictMode

include/pybind11/numpy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ PYBIND11_NAMESPACE_END(detail)
537537

538538
class dtype : public object {
539539
public:
540-
PYBIND11_OBJECT_DEFAULT(dtype, object, detail::npy_api::get().PyArrayDescr_Check_);
540+
PYBIND11_OBJECT_DEFAULT(dtype, object, detail::npy_api::get().PyArrayDescr_Check_)
541541

542542
explicit dtype(const buffer_info &info) {
543543
dtype descr(_dtype_from_pep3118()(pybind11::str(info.format)));

include/pybind11/pytypes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ public:
12831283

12841284
#define PYBIND11_OBJECT_CVT_DEFAULT(Name, Parent, CheckFun, ConvertFun) \
12851285
PYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \
1286-
Name() : Parent() {}
1286+
Name() = default;
12871287

12881288
#define PYBIND11_OBJECT_CHECK_FAILED(Name, o_ptr) \
12891289
::pybind11::type_error("Object of type '" \
@@ -1306,7 +1306,7 @@ public:
13061306

13071307
#define PYBIND11_OBJECT_DEFAULT(Name, Parent, CheckFun) \
13081308
PYBIND11_OBJECT(Name, Parent, CheckFun) \
1309-
Name() : Parent() {}
1309+
Name() = default;
13101310

13111311
/// \addtogroup pytypes
13121312
/// @{

0 commit comments

Comments
 (0)