|
11 | 11 |
|
12 | 12 | #include "numpy.h"
|
13 | 13 |
|
| 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 | + |
14 | 21 | #if defined(__GNUC__)
|
15 | 22 | // These suppressions are needed only for certain compilers and versions of Eigen, but:
|
16 | 23 | // * Maintaining narrowly defined ifdefs is very complicated/expensive.
|
17 | 24 | // * These suppressions are applied only to the Eigen headers anyway.
|
18 | 25 | # pragma GCC diagnostic push
|
19 | 26 | # pragma GCC diagnostic ignored "-Wconversion"
|
20 |
| -#if __GNUC__ != 8 |
| 27 | +#if defined(PYBIND11_COMPATIBILITY_WDEPRECATED_COPY) |
21 | 28 | # pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
22 | 29 | # pragma GCC diagnostic ignored "-Wdeprecated-copy-dtor"
|
23 | 30 | #endif
|
@@ -80,14 +87,14 @@ template <bool EigenRowMajor> struct EigenConformable {
|
80 | 87 | if (rstride < 0 || cstride < 0) {
|
81 | 88 | negativestrides = true;
|
82 | 89 | } else {
|
83 |
| -#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ != 8 |
| 90 | +#if defined(PYBIND11_COMPATIBILITY_WDEPRECATED_COPY) |
84 | 91 | // Suppressing warning originating from Eigen header.
|
85 | 92 | # pragma GCC diagnostic push
|
86 | 93 | # pragma GCC diagnostic ignored "-Wdeprecated-copy"
|
87 | 94 | #endif
|
88 | 95 | stride = {EigenRowMajor ? rstride : cstride /* outer stride */,
|
89 | 96 | EigenRowMajor ? cstride : rstride /* inner stride */ };
|
90 |
| -#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ != 8 |
| 97 | +#if defined(PYBIND11_COMPATIBILITY_WDEPRECATED_COPY) |
91 | 98 | # pragma GCC diagnostic pop
|
92 | 99 | #endif
|
93 | 100 | }
|
|
0 commit comments