Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
8dc31c7b
Commit
8dc31c7b
authored
Sep 10, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: clang-tidy: llvm-namespace-comment
parent
d65e34d6
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
62 additions
and
12 deletions
+62
-12
.clang-tidy
+8
-0
.github/CONTRIBUTING.md
+24
-1
.github/workflows/format.yml
+16
-0
include/pybind11/cast.h
+1
-1
include/pybind11/pytypes.h
+2
-2
tests/local_bindings.h
+1
-1
tests/test_constants_and_functions.cpp
+1
-1
tests/test_custom_type_casters.cpp
+4
-2
tests/test_operator_overloading.cpp
+1
-1
tests/test_smart_ptr.cpp
+2
-1
tests/test_stl.cpp
+1
-1
tests/test_tagbased_polymorphic.cpp
+1
-1
No files found.
.clang-tidy
0 → 100644
View file @
8dc31c7b
FormatStyle: file
Checks: '
-*,
llvm-namespace-comment,
'
HeaderFilterRegex: 'pybind11/.*h'
.github/CONTRIBUTING.md
View file @
8dc31c7b
...
@@ -164,6 +164,30 @@ name, pre-commit):
...
@@ -164,6 +164,30 @@ name, pre-commit):
pre-commit install
pre-commit install
```
```
### Clang-Tidy
To run Clang tidy, the following recipe should work. Files will be modified in
place, so you can use git to monitor the changes.
```
bash
docker run
--rm
-v
$PWD
:/pybind11
-it
silkeh/clang:10
apt-get update
&&
apt-get install python3-dev python3-pytest
cmake
-S
pybind11/
-B
build
-DCMAKE_CXX_CLANG_TIDY
=
"
$(
which clang-tidy
)
;-fix"
cmake
--build
build
```
### Include what you use
To run include what you use, install (
`brew install include-what-you-use`
on
macOS), then run:
```
bash
cmake
-S
.
-B
build-iwyu
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE
=
$(
which include-what-you-use
)
cmake
--build
build
```
The report is sent to stderr; you can pip it into a file if you wish.
### Build recipes
### Build recipes
This builds with the Intel compiler (assuming it is in your path, along with a
This builds with the Intel compiler (assuming it is in your path, along with a
...
@@ -186,7 +210,6 @@ cmake -S pybind11/ -B build
...
@@ -186,7 +210,6 @@ cmake -S pybind11/ -B build
cmake
--build
build
cmake
--build
build
```
```
[
pre-commit
]:
https://pre-commit.com
[
pre-commit
]:
https://pre-commit.com
[
pybind11.readthedocs.org
]:
http://pybind11.readthedocs.org/en/latest
[
pybind11.readthedocs.org
]:
http://pybind11.readthedocs.org/en/latest
[
issue tracker
]:
https://github.com/pybind/pybind11/issues
[
issue tracker
]:
https://github.com/pybind/pybind11/issues
...
...
.github/workflows/format.yml
View file @
8dc31c7b
...
@@ -17,3 +17,19 @@ jobs:
...
@@ -17,3 +17,19 @@ jobs:
-
uses
:
actions/checkout@v2
-
uses
:
actions/checkout@v2
-
uses
:
actions/setup-python@v2
-
uses
:
actions/setup-python@v2
-
uses
:
pre-commit/action@v2.0.0
-
uses
:
pre-commit/action@v2.0.0
clang-tidy
:
name
:
Clang-Tidy
runs-on
:
ubuntu-latest
container
:
silkeh/clang:10
steps
:
-
uses
:
actions/checkout@v2
-
name
:
Install requirements
run
:
apt-get update && apt-get install -y python3-dev python3-pytest
-
name
:
Configure
run
:
cmake -S . -B build -DCMAKE_CXX_CLANG_TIDY="$(which clang-tidy);--warnings-as-errors=*"
-
name
:
Build
run
:
cmake --build build -j 2
include/pybind11/cast.h
View file @
8dc31c7b
...
@@ -1929,7 +1929,7 @@ inline namespace literals {
...
@@ -1929,7 +1929,7 @@ inline namespace literals {
String literal version of `arg`
String literal version of `arg`
\endrst */
\endrst */
constexpr
arg
operator
""
_a
(
const
char
*
name
,
size_t
)
{
return
arg
(
name
);
}
constexpr
arg
operator
""
_a
(
const
char
*
name
,
size_t
)
{
return
arg
(
name
);
}
}
}
// namespace literals
PYBIND11_NAMESPACE_BEGIN
(
detail
)
PYBIND11_NAMESPACE_BEGIN
(
detail
)
...
...
include/pybind11/pytypes.h
View file @
8dc31c7b
...
@@ -35,7 +35,7 @@ namespace accessor_policies {
...
@@ -35,7 +35,7 @@ namespace accessor_policies {
struct
sequence_item
;
struct
sequence_item
;
struct
list_item
;
struct
list_item
;
struct
tuple_item
;
struct
tuple_item
;
}
}
// namespace accessor_policies
using
obj_attr_accessor
=
accessor
<
accessor_policies
::
obj_attr
>
;
using
obj_attr_accessor
=
accessor
<
accessor_policies
::
obj_attr
>
;
using
str_attr_accessor
=
accessor
<
accessor_policies
::
str_attr
>
;
using
str_attr_accessor
=
accessor
<
accessor_policies
::
str_attr
>
;
using
item_accessor
=
accessor
<
accessor_policies
::
generic_item
>
;
using
item_accessor
=
accessor
<
accessor_policies
::
generic_item
>
;
...
@@ -976,7 +976,7 @@ inline namespace literals {
...
@@ -976,7 +976,7 @@ inline namespace literals {
String literal version of `str`
String literal version of `str`
\endrst */
\endrst */
inline
str
operator
""
_s
(
const
char
*
s
,
size_t
size
)
{
return
{
s
,
size
};
}
inline
str
operator
""
_s
(
const
char
*
s
,
size_t
size
)
{
return
{
s
,
size
};
}
}
}
// namespace literals
/// \addtogroup pytypes
/// \addtogroup pytypes
/// @{
/// @{
...
...
tests/local_bindings.h
View file @
8dc31c7b
...
@@ -58,7 +58,7 @@ public:
...
@@ -58,7 +58,7 @@ public:
std
::
string
name_
;
std
::
string
name_
;
const
std
::
string
&
name
()
{
return
name_
;
}
const
std
::
string
&
name
()
{
return
name_
;
}
};
};
}
}
// namespace pets
struct
MixGL
{
int
i
;
MixGL
(
int
i
)
:
i
{
i
}
{}
};
struct
MixGL
{
int
i
;
MixGL
(
int
i
)
:
i
{
i
}
{}
};
struct
MixGL2
{
int
i
;
MixGL2
(
int
i
)
:
i
{
i
}
{}
};
struct
MixGL2
{
int
i
;
MixGL2
(
int
i
)
:
i
{
i
}
{}
};
tests/test_constants_and_functions.cpp
View file @
8dc31c7b
...
@@ -74,7 +74,7 @@ struct C {
...
@@ -74,7 +74,7 @@ struct C {
# pragma GCC diagnostic pop
# pragma GCC diagnostic pop
#endif
#endif
};
};
}
}
// namespace test_exc_sp
TEST_SUBMODULE
(
constants_and_functions
,
m
)
{
TEST_SUBMODULE
(
constants_and_functions
,
m
)
{
...
...
tests/test_custom_type_casters.cpp
View file @
8dc31c7b
...
@@ -58,7 +58,8 @@ public:
...
@@ -58,7 +58,8 @@ public:
return
py
::
none
().
release
();
return
py
::
none
().
release
();
}
}
};
};
}}
}
// namespace detail
}
// namespace pybind11
// test_custom_caster_destruction
// test_custom_caster_destruction
class
DestructionTester
{
class
DestructionTester
{
...
@@ -79,7 +80,8 @@ template <> struct type_caster<DestructionTester> {
...
@@ -79,7 +80,8 @@ template <> struct type_caster<DestructionTester> {
return
py
::
bool_
(
true
).
release
();
return
py
::
bool_
(
true
).
release
();
}
}
};
};
}}
}
// namespace detail
}
// namespace pybind11
TEST_SUBMODULE
(
custom_type_casters
,
m
)
{
TEST_SUBMODULE
(
custom_type_casters
,
m
)
{
// test_custom_type_casters
// test_custom_type_casters
...
...
tests/test_operator_overloading.cpp
View file @
8dc31c7b
...
@@ -73,7 +73,7 @@ namespace std {
...
@@ -73,7 +73,7 @@ namespace std {
// Not a good hash function, but easy to test
// Not a good hash function, but easy to test
size_t
operator
()(
const
Vector2
&
)
{
return
4
;
}
size_t
operator
()(
const
Vector2
&
)
{
return
4
;
}
};
};
}
}
// namespace std
// Not a good abs function, but easy to test.
// Not a good abs function, but easy to test.
std
::
string
abs
(
const
Vector2
&
)
{
std
::
string
abs
(
const
Vector2
&
)
{
...
...
tests/test_smart_ptr.cpp
View file @
8dc31c7b
...
@@ -27,7 +27,8 @@ namespace pybind11 { namespace detail {
...
@@ -27,7 +27,8 @@ namespace pybind11 { namespace detail {
struct
holder_helper
<
ref
<
T
>>
{
struct
holder_helper
<
ref
<
T
>>
{
static
const
T
*
get
(
const
ref
<
T
>
&
p
)
{
return
p
.
get_ptr
();
}
static
const
T
*
get
(
const
ref
<
T
>
&
p
)
{
return
p
.
get_ptr
();
}
};
};
}}
}
// namespace detail
}
// namespace pybind11
// The following is not required anymore for std::shared_ptr, but it should compile without error:
// The following is not required anymore for std::shared_ptr, but it should compile without error:
PYBIND11_DECLARE_HOLDER_TYPE
(
T
,
std
::
shared_ptr
<
T
>
);
PYBIND11_DECLARE_HOLDER_TYPE
(
T
,
std
::
shared_ptr
<
T
>
);
...
...
tests/test_stl.cpp
View file @
8dc31c7b
...
@@ -47,7 +47,7 @@ struct TplCtorClass {
...
@@ -47,7 +47,7 @@ struct TplCtorClass {
namespace
std
{
namespace
std
{
template
<>
template
<>
struct
hash
<
TplCtorClass
>
{
size_t
operator
()(
const
TplCtorClass
&
)
const
{
return
0
;
}
};
struct
hash
<
TplCtorClass
>
{
size_t
operator
()(
const
TplCtorClass
&
)
const
{
return
0
;
}
};
}
}
// namespace std
template
<
template
<
typename
>
class
OptionalImpl
,
typename
T
>
template
<
template
<
typename
>
class
OptionalImpl
,
typename
T
>
...
...
tests/test_tagbased_polymorphic.cpp
View file @
8dc31c7b
...
@@ -117,7 +117,7 @@ namespace pybind11 {
...
@@ -117,7 +117,7 @@ namespace pybind11 {
static
const
void
*
get
(
const
itype
*
src
,
const
std
::
type_info
*&
type
)
static
const
void
*
get
(
const
itype
*
src
,
const
std
::
type_info
*&
type
)
{
type
=
src
?
Animal
::
type_of_kind
(
src
->
kind
)
:
nullptr
;
return
src
;
}
{
type
=
src
?
Animal
::
type_of_kind
(
src
->
kind
)
:
nullptr
;
return
src
;
}
};
};
}
}
// namespace pybind11
TEST_SUBMODULE
(
tagbased_polymorphic
,
m
)
{
TEST_SUBMODULE
(
tagbased_polymorphic
,
m
)
{
py
::
class_
<
Animal
>
(
m
,
"Animal"
)
py
::
class_
<
Animal
>
(
m
,
"Animal"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment