Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Olivier B.
pybind11
Commits
88d1d041
Commit
88d1d041
authored
Jan 20, 2016
by
Wenzel Jakob
Browse files
another attempt to fix the offsetof warnings
parent
9dcb1c3b
Changes
2
Show whitespace changes
Inline
Side-by-side
include/pybind11/common.h
View file @
88d1d041
...
...
@@ -191,14 +191,18 @@ NAMESPACE_BEGIN(detail)
inline
std
::
string
error_string
();
///
PyObject wrapper around generic types
template
<
typename
type
,
typename
holder_type
=
std
::
unique_ptr
<
type
>
>
struct
instance
{
///
Core part of the 'instance' type which POD (needed to be able to use 'offsetof')
template
<
typename
type
>
struct
instance
_essentials
{
PyObject_HEAD
type
*
value
;
PyObject
*
parent
;
PyObject
*
weakrefs
;
bool
owned
:
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
;
};
...
...
include/pybind11/pybind11.h
View file @
88d1d041
...
...
@@ -22,9 +22,6 @@
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
# pragma GCC diagnostic ignored "-Wunused-but-set-variable"
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
# if __GNUC__ >= 4
# pragma GCC diagnostic ignored "-Wno-invalid-offsetof"
# endif
#endif
#include "attr.h"
...
...
@@ -566,7 +563,7 @@ protected:
type
->
ht_type
.
tp_dealloc
=
rec
->
dealloc
;
/* 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 */
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