Skip to content

Commit 024b0bf

Browse files
authored
Merge pull request #701 from OpenXiangShan/bump-pybind
ext: bump pybind to 3.0.0
2 parents 39cd6af + c6928cf commit 024b0bf

File tree

345 files changed

+42406
-13784
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

345 files changed

+42406
-13784
lines changed

ext/pybind11/.appveyor.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 1.0.{build}
22
image:
3-
- Visual Studio 2015
3+
- Visual Studio 2017
44
test: off
55
skip_branch_with_pr: true
66
build:
@@ -9,13 +9,11 @@ platform:
99
- x86
1010
environment:
1111
matrix:
12-
- PYTHON: 36
13-
CONFIG: Debug
14-
- PYTHON: 27
12+
- PYTHON: 38
1513
CONFIG: Debug
1614
install:
1715
- ps: |
18-
$env:CMAKE_GENERATOR = "Visual Studio 14 2015"
16+
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
1917
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
2018
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
2119
python -W ignore -m pip install --upgrade pip wheel

ext/pybind11/.clang-format

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,36 @@
33
# clang-format --style=llvm --dump-config
44
BasedOnStyle: LLVM
55
AccessModifierOffset: -4
6-
AlignConsecutiveAssignments: true
6+
AllowShortLambdasOnASingleLine: true
77
AlwaysBreakTemplateDeclarations: Yes
88
BinPackArguments: false
99
BinPackParameters: false
1010
BreakBeforeBinaryOperators: All
1111
BreakConstructorInitializers: BeforeColon
1212
ColumnLimit: 99
13+
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
14+
IncludeBlocks: Regroup
1315
IndentCaseLabels: true
1416
IndentPPDirectives: AfterHash
1517
IndentWidth: 4
1618
Language: Cpp
1719
SpaceAfterCStyleCast: true
18-
# SpaceInEmptyBlock: true # too new
1920
Standard: Cpp11
21+
StatementMacros: ['PyObject_HEAD']
2022
TabWidth: 4
23+
IncludeCategories:
24+
- Regex: '<pybind11/.*'
25+
Priority: -1
26+
- Regex: 'pybind11.h"$'
27+
Priority: 1
28+
- Regex: '^".*/?detail/'
29+
Priority: 1
30+
SortPriority: 2
31+
- Regex: '^"'
32+
Priority: 1
33+
SortPriority: 3
34+
- Regex: '<[[:alnum:]._]+>'
35+
Priority: 4
36+
- Regex: '.*'
37+
Priority: 5
2138
...

ext/pybind11/.clang-tidy

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,80 @@
11
FormatStyle: file
22

3-
Checks: '
4-
llvm-namespace-comment,
5-
modernize-use-override,
6-
readability-container-size-empty,
7-
modernize-use-using,
8-
modernize-use-equals-default,
9-
modernize-use-auto,
10-
modernize-use-emplace,
11-
'
3+
Checks: |
4+
*bugprone*,
5+
*performance*,
6+
clang-analyzer-optin.cplusplus.VirtualCall,
7+
clang-analyzer-optin.performance.Padding,
8+
cppcoreguidelines-init-variables,
9+
cppcoreguidelines-prefer-member-initializer,
10+
cppcoreguidelines-pro-type-static-cast-downcast,
11+
cppcoreguidelines-slicing,
12+
google-explicit-constructor,
13+
llvm-namespace-comment,
14+
misc-definitions-in-headers,
15+
misc-misplaced-const,
16+
misc-non-copyable-objects,
17+
misc-static-assert,
18+
misc-throw-by-value-catch-by-reference,
19+
misc-uniqueptr-reset-release,
20+
misc-unused-parameters,
21+
modernize-avoid-bind,
22+
modernize-loop-convert,
23+
modernize-make-shared,
24+
modernize-redundant-void-arg,
25+
modernize-replace-auto-ptr,
26+
modernize-replace-disallow-copy-and-assign-macro,
27+
modernize-replace-random-shuffle,
28+
modernize-shrink-to-fit,
29+
modernize-use-auto,
30+
modernize-use-bool-literals,
31+
modernize-use-default-member-init,
32+
modernize-use-emplace,
33+
modernize-use-equals-default,
34+
modernize-use-equals-delete,
35+
modernize-use-noexcept,
36+
modernize-use-nullptr,
37+
modernize-use-override,
38+
modernize-use-using,
39+
readability-avoid-const-params-in-decls,
40+
readability-braces-around-statements,
41+
readability-const-return-type,
42+
readability-container-size-empty,
43+
readability-delete-null-pointer,
44+
readability-else-after-return,
45+
readability-implicit-bool-conversion,
46+
readability-inconsistent-declaration-parameter-name,
47+
readability-make-member-function-const,
48+
readability-misplaced-array-index,
49+
readability-non-const-parameter,
50+
readability-qualified-auto,
51+
readability-redundant-function-ptr-dereference,
52+
readability-redundant-smartptr-get,
53+
readability-redundant-string-cstr,
54+
readability-simplify-subscript-expr,
55+
readability-static-accessed-through-instance,
56+
readability-static-definition-in-anonymous-namespace,
57+
readability-string-compare,
58+
readability-suspicious-call-argument,
59+
readability-uniqueptr-delete-release,
60+
-bugprone-chained-comparison,
61+
-bugprone-easily-swappable-parameters,
62+
-bugprone-exception-escape,
63+
-bugprone-reserved-identifier,
64+
-bugprone-unused-raii,
65+
-performance-enum-size,
66+
-performance-inefficient-string-concatenation,
67+
68+
CheckOptions:
69+
- key: modernize-use-equals-default.IgnoreMacros
70+
value: false
71+
- key: performance-for-range-copy.WarnOnAllAutoCopies
72+
value: true
73+
- key: performance-inefficient-string-concatenation.StrictMode
74+
value: true
75+
- key: performance-unnecessary-value-param.AllowedTypes
76+
value: 'exception_ptr$;'
77+
- key: readability-implicit-bool-conversion.AllowPointerConditions
78+
value: true
1279

1380
HeaderFilterRegex: 'pybind11/.*h'
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
2+
template <typename ThisT>
3+
auto &this_ = static_cast<ThisT &>(*this);
4+
if (load_impl<ThisT>(temp, false)) {
5+
ssize_t nd = 0;
6+
auto trivial = broadcast(buffers, nd, shape);
7+
auto ndim = (size_t) nd;
8+
int nd;
9+
ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
10+
using op = op_impl<id, ot, Base, L_type, R_type>;
11+
template <op_id id, op_type ot, typename L, typename R>
12+
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
13+
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
14+
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
15+
int valu;
16+
explicit movable_int(int v) : valu{v} {}
17+
movable_int(movable_int &&other) noexcept : valu(other.valu) { other.valu = 91; }
18+
explicit indestructible_int(int v) : valu{v} {}
19+
REQUIRE(hld.as_raw_ptr_unowned<zombie>()->valu == 19);
20+
REQUIRE(othr.valu == 19);
21+
REQUIRE(orig.valu == 91);
22+
(m.pass_valu, "Valu", "pass_valu:Valu(_MvCtor)*_CpCtor"),
23+
atyp_valu rtrn_valu() { atyp_valu obj{"Valu"}; return obj; }
24+
assert m.atyp_valu().get_mtxt() == "Valu"
25+
// valu(e), ref(erence), ptr or p (pointer), r = rvalue, m = mutable, c = const,
26+
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
27+
struct IntStruct {
28+
explicit IntStruct(int v) : value(v){};
29+
~IntStruct() { value = -value; }
30+
IntStruct(const IntStruct &) = default;
31+
IntStruct &operator=(const IntStruct &) = default;
32+
py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
33+
py::implicitly_convertible<int, IntStruct>();
34+
m.def("test", [](int expected, const IntStruct &in) {
35+
[](int expected, const IntStruct &in) {

ext/pybind11/.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/*.svg binary

ext/pybind11/.github/CODEOWNERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.cmake @henryiii
2+
CMakeLists.txt @henryiii
3+
*.yml @henryiii
4+
*.yaml @henryiii
5+
/tools/ @henryiii
6+
/pybind11/ @henryiii
7+
noxfile.py @henryiii
8+
.clang-format @henryiii
9+
.clang-tidy @henryiii

0 commit comments

Comments
 (0)