Skip to content

Commit e90a959

Browse files
committed
* Removing stray semicolons (discovered by running clang-format v12 followed by tools/check-style.sh).
(* Manually moving `// NOLINT` and `// NOLINTNEXTLINE` comments so that clang-format does not move them to the wrong places.) * Manually reformatting comments related to `static_assert`s so that clang-format does not need two passes. * Empty lines between #includes, to prevent clang-format from shuffling the order and thereby confusing MSVC 2015. * git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
1 parent 7509064 commit e90a959

File tree

7 files changed

+19
-12
lines changed

7 files changed

+19
-12
lines changed

include/pybind11/attr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ struct metaclass {
6262
handle value;
6363

6464
PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
65-
metaclass() { } // NOLINT(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
65+
// NOLINTNEXTLINE(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
66+
metaclass() {}
6667

6768
/// Override pybind11's default metaclass
6869
explicit metaclass(handle value) : value(value) { }

include/pybind11/detail/common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,8 @@ struct nodelete { template <typename T> void operator()(T*) { } };
801801
PYBIND11_NAMESPACE_BEGIN(detail)
802802
template <typename... Args>
803803
struct overload_cast_impl {
804-
constexpr overload_cast_impl() {}; // NOLINT(modernize-use-equals-default): MSVC 2015 needs this
804+
// NOLINTNEXTLINE(modernize-use-equals-default): MSVC 2015 needs this
805+
constexpr overload_cast_impl() {}
805806

806807
template <typename Return>
807808
constexpr auto operator()(Return (*pf)(Args...)) const noexcept

tests/pybind11_tests.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
#pragma once
2+
3+
// This must be kept first for MSVC 2015.
4+
// Do not remove the empty line between the #includes.
25
#include <pybind11/pybind11.h>
6+
37
#include <pybind11/eval.h>
48

59
#if defined(_MSC_VER) && _MSC_VER < 1910
610
// We get some really long type names here which causes MSVC 2015 to emit warnings
7-
# pragma warning(disable: 4503) // warning C4503: decorated name length exceeded, name was truncated
11+
# pragma warning( \
12+
disable : 4503) // warning C4503: decorated name length exceeded, name was truncated
813
#endif
914

1015
namespace py = pybind11;

tests/test_buffers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ TEST_SUBMODULE(buffers, m) {
154154
py::format_descriptor<int32_t>::format(), 1);
155155
}
156156

157-
ConstBuffer() : value(new int32_t{0}) { };
157+
ConstBuffer() : value(new int32_t{0}) {}
158158
};
159159
py::class_<ConstBuffer>(m, "ConstBuffer", py::buffer_protocol())
160160
.def(py::init<>())

tests/test_callbacks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ TEST_SUBMODULE(callbacks, m) {
122122
// [workaround(intel)] = default does not work here
123123
// Defaulting this destructor results in linking errors with the Intel compiler
124124
// (in Debug builds only, tested with icpc (ICC) 2021.1 Beta 20200827)
125-
virtual ~AbstractBase() {}; // NOLINT(modernize-use-equals-default)
125+
virtual ~AbstractBase() {} // NOLINT(modernize-use-equals-default)
126126
virtual unsigned int func() = 0;
127127
};
128128
m.def("func_accepting_func_accepting_base",

tests/test_methods_and_attributes.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class NoneCastTester {
123123
public:
124124
int answer = -1;
125125
NoneCastTester() = default;
126-
NoneCastTester(int v) : answer(v) {};
126+
NoneCastTester(int v) : answer(v) {}
127127
};
128128

129129
struct StrIssue {
@@ -390,14 +390,14 @@ TEST_SUBMODULE(methods_and_attributes, m) {
390390
.def("increase_value", &RegisteredDerived::increase_value)
391391
.def_readwrite("rw_value", &RegisteredDerived::rw_value)
392392
.def_readonly("ro_value", &RegisteredDerived::ro_value)
393-
// These should trigger a static_assert if uncommented
394-
//.def_readwrite("fails", &UserType::value) // should trigger a static_assert if uncommented
395-
//.def_readonly("fails", &UserType::value) // should trigger a static_assert if uncommented
393+
// Uncommenting the next line should trigger a static_assert:
394+
// .def_readwrite("fails", &UserType::value)
395+
// Uncommenting the next line should trigger a static_assert:
396+
// .def_readonly("fails", &UserType::value)
396397
.def_property("rw_value_prop", &RegisteredDerived::get_int, &RegisteredDerived::set_int)
397398
.def_property_readonly("ro_value_prop", &RegisteredDerived::get_double)
398399
// This one is in the registered class:
399-
.def("sum", &RegisteredDerived::sum)
400-
;
400+
.def("sum", &RegisteredDerived::sum);
401401

402402
using Adapted = decltype(py::method_adaptor<RegisteredDerived>(&RegisteredDerived::do_nothing));
403403
static_assert(std::is_same<Adapted, void (RegisteredDerived::*)() const>::value, "");

tests/test_smart_ptr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ template <typename T> class huge_unique_ptr {
2424
std::unique_ptr<T> ptr;
2525
uint64_t padding[10];
2626
public:
27-
huge_unique_ptr(T *p) : ptr(p) {};
27+
huge_unique_ptr(T *p) : ptr(p) {}
2828
T *get() { return ptr.get(); }
2929
};
3030

0 commit comments

Comments
 (0)