mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix MSVC build: disable [[msvc::forceinline]] on generic lambdas
libeigen/eigen!2171 Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
@@ -908,12 +908,11 @@
|
|||||||
|
|
||||||
// EIGEN_LAMBDA_ALWAYS_INLINE forces inlining of lambda functions.
|
// EIGEN_LAMBDA_ALWAYS_INLINE forces inlining of lambda functions.
|
||||||
// On GCC/Clang, __attribute__((always_inline)) works on lambdas.
|
// On GCC/Clang, __attribute__((always_inline)) works on lambdas.
|
||||||
// On MSVC, __forceinline cannot be applied to lambdas, but the
|
// On MSVC, [[msvc::forceinline]] cannot be applied to generic lambdas
|
||||||
// [[msvc::forceinline]] attribute (available since VS 2022 17.1) can.
|
// (those with auto parameters), so we leave it empty and rely on the
|
||||||
|
// optimizer to inline small lambda bodies at /O2.
|
||||||
#if EIGEN_COMP_GNUC && !defined(SYCL_DEVICE_ONLY)
|
#if EIGEN_COMP_GNUC && !defined(SYCL_DEVICE_ONLY)
|
||||||
#define EIGEN_LAMBDA_ALWAYS_INLINE __attribute__((always_inline))
|
#define EIGEN_LAMBDA_ALWAYS_INLINE __attribute__((always_inline))
|
||||||
#elif EIGEN_COMP_MSVC >= 1931
|
|
||||||
#define EIGEN_LAMBDA_ALWAYS_INLINE [[msvc::forceinline]]
|
|
||||||
#else
|
#else
|
||||||
#define EIGEN_LAMBDA_ALWAYS_INLINE
|
#define EIGEN_LAMBDA_ALWAYS_INLINE
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user