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
88d1d041
Commit
88d1d041
authored
Jan 20, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
another attempt to fix the offsetof warnings
parent
9dcb1c3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
include/pybind11/common.h
+6
-2
include/pybind11/pybind11.h
+1
-4
No files found.
include/pybind11/common.h
View file @
88d1d041
...
@@ -191,14 +191,18 @@ NAMESPACE_BEGIN(detail)
...
@@ -191,14 +191,18 @@ NAMESPACE_BEGIN(detail)
inline
std
::
string
error_string
();
inline
std
::
string
error_string
();
///
PyObject wrapper around generic types
///
Core part of the 'instance' type which POD (needed to be able to use 'offsetof')
template
<
typename
type
,
typename
holder_type
=
std
::
unique_ptr
<
type
>>
struct
instance
{
template
<
typename
type
>
struct
instance_essentials
{
PyObject_HEAD
PyObject_HEAD
type
*
value
;
type
*
value
;
PyObject
*
parent
;
PyObject
*
parent
;
PyObject
*
weakrefs
;
PyObject
*
weakrefs
;
bool
owned
:
1
;
bool
owned
:
1
;
bool
constructed
:
1
;
bool
constructed
:
1
;
};
/// PyObject wrapper around generic types, includes a special holder type that is responsible for lifetime management
template
<
typename
type
,
typename
holder_type
=
std
::
unique_ptr
<
type
>>
struct
instance
:
instance_essentials
<
type
>
{
holder_type
holder
;
holder_type
holder
;
};
};
...
...
include/pybind11/pybind11.h
View file @
88d1d041
...
@@ -22,9 +22,6 @@
...
@@ -22,9 +22,6 @@
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
# if __GNUC__ >= 4
# pragma GCC diagnostic ignored "-Wno-invalid-offsetof"
# endif
#endif
#endif
#include "attr.h"
#include "attr.h"
...
@@ -566,7 +563,7 @@ protected:
...
@@ -566,7 +563,7 @@ protected:
type
->
ht_type
.
tp_dealloc
=
rec
->
dealloc
;
type
->
ht_type
.
tp_dealloc
=
rec
->
dealloc
;
/* Support weak references (needed for the keep_alive feature) */
/* Support weak references (needed for the keep_alive feature) */
type
->
ht_type
.
tp_weaklistoffset
=
offsetof
(
instance
<
void
>
,
weakrefs
);
type
->
ht_type
.
tp_weaklistoffset
=
offsetof
(
instance
_essentials
<
void
>
,
weakrefs
);
/* Flags */
/* Flags */
type
->
ht_type
.
tp_flags
|=
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_BASETYPE
|
Py_TPFLAGS_HEAPTYPE
;
type
->
ht_type
.
tp_flags
|=
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_BASETYPE
|
Py_TPFLAGS_HEAPTYPE
;
...
...
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