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
3fe59b9b
Commit
3fe59b9b
authored
Feb 18, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #103 from bennybp/master
Fixes and additions for Intel compilers
parents
f8584b63
33f3430d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
10 deletions
+29
-10
CMakeLists.txt
+8
-1
include/pybind11/attr.h
+1
-1
include/pybind11/cast.h
+8
-1
include/pybind11/common.h
+1
-1
include/pybind11/operators.h
+5
-5
include/pybind11/pybind11.h
+6
-1
No files found.
CMakeLists.txt
View file @
3fe59b9b
...
@@ -38,7 +38,7 @@ endif()
...
@@ -38,7 +38,7 @@ endif()
string
(
REPLACE
"+"
""
PYTHONLIBS_VERSION_STRING
"+
${
PYTHONLIBS_VERSION_STRING
}
"
)
string
(
REPLACE
"+"
""
PYTHONLIBS_VERSION_STRING
"+
${
PYTHONLIBS_VERSION_STRING
}
"
)
find_package
(
PythonInterp
${
PYTHONLIBS_VERSION_STRING
}
EXACT REQUIRED
)
find_package
(
PythonInterp
${
PYTHONLIBS_VERSION_STRING
}
EXACT REQUIRED
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
OR CMAKE_CXX_COMPILER_ID MATCHES
"GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES
"Intel"
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++14"
HAS_CPP14_FLAG
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++14"
HAS_CPP14_FLAG
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
HAS_CPP11_FLAG
)
CHECK_CXX_COMPILER_FLAG
(
"-std=c++11"
HAS_CPP11_FLAG
)
...
@@ -57,10 +57,17 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
...
@@ -57,10 +57,17 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden"
)
# Check for Link Time Optimization support
# Check for Link Time Optimization support
# (GCC/Clang)
CHECK_CXX_COMPILER_FLAG
(
"-flto"
HAS_LTO_FLAG
)
CHECK_CXX_COMPILER_FLAG
(
"-flto"
HAS_LTO_FLAG
)
if
(
HAS_LTO_FLAG
)
if
(
HAS_LTO_FLAG
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-flto"
)
endif
()
endif
()
# Intel equivalent to LTO is called IPO
CHECK_CXX_COMPILER_FLAG
(
"-ipo"
HAS_IPO_FLAG
)
if
(
HAS_IPO_FLAG
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-ipo"
)
endif
()
endif
()
endif
()
endif
()
endif
()
...
...
include/pybind11/attr.h
View file @
3fe59b9b
...
@@ -277,7 +277,7 @@ template <int Nurse, int Patient> struct process_attribute<keep_alive<Nurse, Pat
...
@@ -277,7 +277,7 @@ template <int Nurse, int Patient> struct process_attribute<keep_alive<Nurse, Pat
};
};
/// Ignore that a variable is unused in compiler warnings
/// Ignore that a variable is unused in compiler warnings
template
<
class
T
>
void
ignore_unused
(
const
T
&
)
{
}
inline
void
ignore_unused
(
const
int
*
)
{
}
/// Recursively iterate over variadic template arguments
/// Recursively iterate over variadic template arguments
template
<
typename
...
Args
>
struct
process_attributes
{
template
<
typename
...
Args
>
struct
process_attributes
{
...
...
include/pybind11/cast.h
View file @
3fe59b9b
...
@@ -519,9 +519,16 @@ public:
...
@@ -519,9 +519,16 @@ public:
explicit
operator
type
*
()
{
return
this
->
value
;
}
explicit
operator
type
*
()
{
return
this
->
value
;
}
explicit
operator
type
&
()
{
return
*
(
this
->
value
);
}
explicit
operator
type
&
()
{
return
*
(
this
->
value
);
}
explicit
operator
holder_type
&
()
{
return
holder
;
}
explicit
operator
holder_type
*
()
{
return
&
holder
;
}
explicit
operator
holder_type
*
()
{
return
&
holder
;
}
// Workaround for Intel compiler bug
// see pybind11 issue 94
#if defined(__ICC) || defined(__INTEL_COMPILER)
operator
holder_type
&
()
{
return
holder
;
}
#else
explicit
operator
holder_type
&
()
{
return
holder
;
}
#endif
static
handle
cast
(
const
holder_type
&
src
,
return_value_policy
policy
,
handle
parent
)
{
static
handle
cast
(
const
holder_type
&
src
,
return_value_policy
policy
,
handle
parent
)
{
return
type_caster_generic
::
cast
(
return
type_caster_generic
::
cast
(
src
.
get
(),
policy
,
parent
,
&
typeid
(
type
),
&
copy_constructor
,
&
src
);
src
.
get
(),
policy
,
parent
,
&
typeid
(
type
),
&
copy_constructor
,
&
src
);
...
...
include/pybind11/common.h
View file @
3fe59b9b
...
@@ -149,7 +149,7 @@ enum class return_value_policy : int {
...
@@ -149,7 +149,7 @@ enum class return_value_policy : int {
/// Format strings for basic number types
/// Format strings for basic number types
template
<
typename
type
>
struct
format_descriptor
{
};
template
<
typename
type
>
struct
format_descriptor
{
};
#define PYBIND11_DECL_FMT(t, n) template<> struct format_descriptor<t> { static std::string value() { return n; }; }
;
#define PYBIND11_DECL_FMT(t, n) template<> struct format_descriptor<t> { static std::string value() { return n; }; }
PYBIND11_DECL_FMT
(
int8_t
,
"b"
);
PYBIND11_DECL_FMT
(
uint8_t
,
"B"
);
PYBIND11_DECL_FMT
(
int16_t
,
"h"
);
PYBIND11_DECL_FMT
(
uint16_t
,
"H"
);
PYBIND11_DECL_FMT
(
int8_t
,
"b"
);
PYBIND11_DECL_FMT
(
uint8_t
,
"B"
);
PYBIND11_DECL_FMT
(
int16_t
,
"h"
);
PYBIND11_DECL_FMT
(
uint16_t
,
"H"
);
PYBIND11_DECL_FMT
(
int32_t
,
"i"
);
PYBIND11_DECL_FMT
(
uint32_t
,
"I"
);
PYBIND11_DECL_FMT
(
int64_t
,
"q"
);
PYBIND11_DECL_FMT
(
uint64_t
,
"Q"
);
PYBIND11_DECL_FMT
(
int32_t
,
"i"
);
PYBIND11_DECL_FMT
(
uint32_t
,
"I"
);
PYBIND11_DECL_FMT
(
int64_t
,
"q"
);
PYBIND11_DECL_FMT
(
uint64_t
,
"Q"
);
PYBIND11_DECL_FMT
(
float
,
"f"
);
PYBIND11_DECL_FMT
(
double
,
"d"
);
PYBIND11_DECL_FMT
(
bool
,
"?"
);
PYBIND11_DECL_FMT
(
float
,
"f"
);
PYBIND11_DECL_FMT
(
double
,
"d"
);
PYBIND11_DECL_FMT
(
bool
,
"?"
);
...
...
include/pybind11/operators.h
View file @
3fe59b9b
...
@@ -76,13 +76,13 @@ template <typename B, typename L, typename R> struct op_impl<op_##id, op_r, B, L
...
@@ -76,13 +76,13 @@ template <typename B, typename L, typename R> struct op_impl<op_##id, op_r, B, L
}; \
}; \
inline op_<op_##id, op_l, self_t, self_t> op(const self_t &, const self_t &) { \
inline op_<op_##id, op_l, self_t, self_t> op(const self_t &, const self_t &) { \
return op_<op_##id, op_l, self_t, self_t>(); \
return op_<op_##id, op_l, self_t, self_t>(); \
}
;
\
}
\
template <typename T> op_<op_##id, op_l, self_t, T> op(const self_t &, const T &) { \
template <typename T> op_<op_##id, op_l, self_t, T> op(const self_t &, const T &) { \
return op_<op_##id, op_l, self_t, T>(); \
return op_<op_##id, op_l, self_t, T>(); \
}
;
\
}
\
template <typename T> op_<op_##id, op_r, T, self_t> op(const T &, const self_t &) { \
template <typename T> op_<op_##id, op_r, T, self_t> op(const T &, const self_t &) { \
return op_<op_##id, op_r, T, self_t>(); \
return op_<op_##id, op_r, T, self_t>(); \
}
;
}
#define PYBIND11_INPLACE_OPERATOR(id, op, expr) \
#define PYBIND11_INPLACE_OPERATOR(id, op, expr) \
template <typename B, typename L, typename R> struct op_impl<op_##id, op_l, B, L, R> { \
template <typename B, typename L, typename R> struct op_impl<op_##id, op_l, B, L, R> { \
...
@@ -92,7 +92,7 @@ template <typename B, typename L, typename R> struct op_impl<op_##id, op_l, B, L
...
@@ -92,7 +92,7 @@ template <typename B, typename L, typename R> struct op_impl<op_##id, op_l, B, L
}; \
}; \
template <typename T> op_<op_##id, op_l, self_t, T> op(const self_t &, const T &) { \
template <typename T> op_<op_##id, op_l, self_t, T> op(const self_t &, const T &) { \
return op_<op_##id, op_l, self_t, T>(); \
return op_<op_##id, op_l, self_t, T>(); \
}
;
}
#define PYBIND11_UNARY_OPERATOR(id, op, expr) \
#define PYBIND11_UNARY_OPERATOR(id, op, expr) \
template <typename B, typename L> struct op_impl<op_##id, op_u, B, L, undefined_t> { \
template <typename B, typename L> struct op_impl<op_##id, op_u, B, L, undefined_t> { \
...
@@ -102,7 +102,7 @@ template <typename B, typename L> struct op_impl<op_##id, op_u, B, L, undefined_
...
@@ -102,7 +102,7 @@ template <typename B, typename L> struct op_impl<op_##id, op_u, B, L, undefined_
}; \
}; \
inline op_<op_##id, op_u, self_t, undefined_t> op(const self_t &) { \
inline op_<op_##id, op_u, self_t, undefined_t> op(const self_t &) { \
return op_<op_##id, op_u, self_t, undefined_t>(); \
return op_<op_##id, op_u, self_t, undefined_t>(); \
}
;
}
PYBIND11_BINARY_OPERATOR
(
sub
,
rsub
,
operator
-
,
l
-
r
)
PYBIND11_BINARY_OPERATOR
(
sub
,
rsub
,
operator
-
,
l
-
r
)
PYBIND11_BINARY_OPERATOR
(
add
,
radd
,
operator
+
,
l
+
r
)
PYBIND11_BINARY_OPERATOR
(
add
,
radd
,
operator
+
,
l
+
r
)
...
...
include/pybind11/pybind11.h
View file @
3fe59b9b
...
@@ -17,6 +17,9 @@
...
@@ -17,6 +17,9 @@
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
# pragma warning(disable: 4512) // warning C4512: Assignment operator was implicitly defined as deleted
# pragma warning(disable: 4512) // warning C4512: Assignment operator was implicitly defined as deleted
#elif defined(__ICC) || defined(__INTEL_COMPILER)
# pragma warning(push)
# pragma warning(disable:2196) // warning #2196: routine is both "inline" and "noinline"
#elif defined(__GNUG__) and !defined(__clang__)
#elif defined(__GNUG__) and !defined(__clang__)
# pragma GCC diagnostic push
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
# pragma GCC diagnostic ignored "-Wunused-but-set-parameter"
...
@@ -972,7 +975,7 @@ PYBIND11_NOINLINE inline void keep_alive_impl(int Nurse, int Patient, handle arg
...
@@ -972,7 +975,7 @@ PYBIND11_NOINLINE inline void keep_alive_impl(int Nurse, int Patient, handle arg
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
detail
)
template
<
typename
...
Args
>
detail
::
init
<
Args
...
>
init
()
{
return
detail
::
init
<
Args
...
>
();
}
;
template
<
typename
...
Args
>
detail
::
init
<
Args
...
>
init
()
{
return
detail
::
init
<
Args
...
>
();
}
template
<
typename
InputType
,
typename
OutputType
>
void
implicitly_convertible
()
{
template
<
typename
InputType
,
typename
OutputType
>
void
implicitly_convertible
()
{
auto
implicit_caster
=
[](
PyObject
*
obj
,
PyTypeObject
*
type
)
->
PyObject
*
{
auto
implicit_caster
=
[](
PyObject
*
obj
,
PyTypeObject
*
type
)
->
PyObject
*
{
...
@@ -1054,6 +1057,8 @@ NAMESPACE_END(pybind11)
...
@@ -1054,6 +1057,8 @@ NAMESPACE_END(pybind11)
#if defined(_MSC_VER)
#if defined(_MSC_VER)
# pragma warning(pop)
# pragma warning(pop)
#elif defined(__ICC) || defined(__INTEL_COMPILER)
# pragma warning(pop)
#elif defined(__GNUG__) and !defined(__clang__)
#elif defined(__GNUG__) and !defined(__clang__)
# pragma GCC diagnostic pop
# pragma GCC diagnostic pop
#endif
#endif
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