mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
Removing obsolete eigen.h warning suppression pragmas. (#3198)
* Removing all pragma from eigen.h * Removing -Werror or equivalent from tests/CMakeLists.txt * Restoring tests/CMakeLists.txt from master. * Adding 4 PYBIND11_SILENCE_MSVC_C4127. * Compatibility with -Wconversion, -Wdeprecated * Introducing PYBIND11_COMPATIBILITY_WDEPRECATED_COPY * Systematically using --verbose for compilations where possible (cmake 3.14 or newer). Also changing all `cmake -t` to `--target`, `-v` to `--verbose`, `check` to `pytest`, for consistency (to make it easier to pin-point all commands of a certain type). Also removing one `-j 2` for `pytest` in hopes of reducing flakes due to races in test_iostream and in prints from destructors. * Commenting out pragmas as an experiment to reproduce previous observation. * Removing all (newly added, but already commented-out) pragma code, adding HINT use -isystem (as cmake does). * Restoring ci.yml from master. Those changes are better handled separately. BTW: in the last CI run there was still a test_iostream flake, even without the -j 2 for running the tests (verfied by inspecting the log).
This commit is contained in:
parent
617cb653ec
commit
774b5ff90b
@ -9,30 +9,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/* HINT: To suppress warnings originating from the Eigen headers, use -isystem.
|
||||||
|
See also:
|
||||||
|
https://stackoverflow.com/questions/2579576/i-dir-vs-isystem-dir
|
||||||
|
https://stackoverflow.com/questions/1741816/isystem-for-ms-visual-studio-c-compiler
|
||||||
|
*/
|
||||||
|
|
||||||
#include "numpy.h"
|
#include "numpy.h"
|
||||||
|
|
||||||
#if defined(__INTEL_COMPILER)
|
|
||||||
# pragma warning(disable: 1682) // implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
|
|
||||||
#elif defined(__GNUG__) || defined(__clang__)
|
|
||||||
# pragma GCC diagnostic push
|
|
||||||
# pragma GCC diagnostic ignored "-Wconversion"
|
|
||||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
# ifdef __clang__
|
|
||||||
// Eigen generates a bunch of implicit-copy-constructor-is-deprecated warnings with -Wdeprecated
|
|
||||||
// under Clang, so disable that warning here:
|
|
||||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
|
||||||
# endif
|
|
||||||
# if __GNUC__ >= 7
|
|
||||||
# pragma GCC diagnostic ignored "-Wint-in-bool-context"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
# pragma warning(push)
|
|
||||||
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
|
|
||||||
# pragma warning(disable: 4996) // warning C4996: std::unary_negate is deprecated in C++17
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <Eigen/Core>
|
#include <Eigen/Core>
|
||||||
#include <Eigen/SparseCore>
|
#include <Eigen/SparseCore>
|
||||||
|
|
||||||
@ -153,7 +137,8 @@ template <typename Type_> struct EigenProps {
|
|||||||
np_cols = a.shape(1),
|
np_cols = a.shape(1),
|
||||||
np_rstride = a.strides(0) / static_cast<ssize_t>(sizeof(Scalar)),
|
np_rstride = a.strides(0) / static_cast<ssize_t>(sizeof(Scalar)),
|
||||||
np_cstride = a.strides(1) / static_cast<ssize_t>(sizeof(Scalar));
|
np_cstride = a.strides(1) / static_cast<ssize_t>(sizeof(Scalar));
|
||||||
if ((fixed_rows && np_rows != rows) || (fixed_cols && np_cols != cols))
|
if ((PYBIND11_SILENCE_MSVC_C4127(fixed_rows) && np_rows != rows) ||
|
||||||
|
(PYBIND11_SILENCE_MSVC_C4127(fixed_cols) && np_cols != cols))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return {np_rows, np_cols, np_rstride, np_cstride};
|
return {np_rows, np_cols, np_rstride, np_cstride};
|
||||||
@ -165,7 +150,7 @@ template <typename Type_> struct EigenProps {
|
|||||||
stride = a.strides(0) / static_cast<ssize_t>(sizeof(Scalar));
|
stride = a.strides(0) / static_cast<ssize_t>(sizeof(Scalar));
|
||||||
|
|
||||||
if (vector) { // Eigen type is a compile-time vector
|
if (vector) { // Eigen type is a compile-time vector
|
||||||
if (fixed && size != n)
|
if (PYBIND11_SILENCE_MSVC_C4127(fixed) && size != n)
|
||||||
return false; // Vector size mismatch
|
return false; // Vector size mismatch
|
||||||
return {rows == 1 ? 1 : n, cols == 1 ? 1 : n, stride};
|
return {rows == 1 ? 1 : n, cols == 1 ? 1 : n, stride};
|
||||||
}
|
}
|
||||||
@ -179,7 +164,7 @@ template <typename Type_> struct EigenProps {
|
|||||||
if (cols != n) return false;
|
if (cols != n) return false;
|
||||||
return {1, n, stride};
|
return {1, n, stride};
|
||||||
} // Otherwise it's either fully dynamic, or column dynamic; both become a column vector
|
} // Otherwise it's either fully dynamic, or column dynamic; both become a column vector
|
||||||
if (fixed_rows && rows != n) return false;
|
if (PYBIND11_SILENCE_MSVC_C4127(fixed_rows) && rows != n) return false;
|
||||||
return {n, 1, stride};
|
return {n, 1, stride};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,9 +581,3 @@ struct type_caster<Type, enable_if_t<is_eigen_sparse<Type>::value>> {
|
|||||||
|
|
||||||
PYBIND11_NAMESPACE_END(detail)
|
PYBIND11_NAMESPACE_END(detail)
|
||||||
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
||||||
|
|
||||||
#if defined(__GNUG__) || defined(__clang__)
|
|
||||||
# pragma GCC diagnostic pop
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
# pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user