Skip to content

Commit 869bcc5

Browse files
committed
Introducing PYBIND11_COMPATIBILITY_WDEPRECATED_COPY
1 parent c3067cc commit 869bcc5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

include/pybind11/eigen.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@
1111

1212
#include "numpy.h"
1313

14+
// This will need maintenance as new supported platforms are added.
15+
#if !defined(__APPLE__) \
16+
&& (defined(__GNUC__) && __GNUC__ >= 9 || \
17+
defined(__clang_major__) && __clang_major__ >= 10)
18+
#define PYBIND11_COMPATIBILITY_WDEPRECATED_COPY
19+
#endif
20+
1421
#if defined(__GNUC__)
1522
// These suppressions are needed only for certain compilers and versions of Eigen, but:
1623
// * Maintaining narrowly defined ifdefs is very complicated/expensive.
1724
// * These suppressions are applied only to the Eigen headers anyway.
1825
# pragma GCC diagnostic push
1926
# pragma GCC diagnostic ignored "-Wconversion"
20-
#if __GNUC__ != 8
27+
#if defined(PYBIND11_COMPATIBILITY_WDEPRECATED_COPY)
2128
# pragma GCC diagnostic ignored "-Wdeprecated-copy"
2229
# pragma GCC diagnostic ignored "-Wdeprecated-copy-dtor"
2330
#endif
@@ -80,14 +87,14 @@ template <bool EigenRowMajor> struct EigenConformable {
8087
if (rstride < 0 || cstride < 0) {
8188
negativestrides = true;
8289
} else {
83-
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ != 8
90+
#if defined(PYBIND11_COMPATIBILITY_WDEPRECATED_COPY)
8491
// Suppressing warning originating from Eigen header.
8592
# pragma GCC diagnostic push
8693
# pragma GCC diagnostic ignored "-Wdeprecated-copy"
8794
#endif
8895
stride = {EigenRowMajor ? rstride : cstride /* outer stride */,
8996
EigenRowMajor ? cstride : rstride /* inner stride */ };
90-
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ != 8
97+
#if defined(PYBIND11_COMPATIBILITY_WDEPRECATED_COPY)
9198
# pragma GCC diagnostic pop
9299
#endif
93100
}

0 commit comments

Comments
 (0)