Avoid breaking the build on older compilers.

See merge request libeigen/eigen!2068

Co-authored-by: Rasmus Munk Larsen <rmlarsen@google.com>
This commit is contained in:
Rasmus Munk Larsen
2025-11-07 21:25:09 +00:00
parent da867c31c9
commit ffcd7bdbd6
4 changed files with 20 additions and 12 deletions

View File

@@ -700,6 +700,13 @@
#define EIGEN_HAS_BUILTIN(x) 0
#endif
// Cross compiler wrapper around LLVM's __has_attribute
#ifdef __has_attribute
#define EIGEN_HAS_ATTRIBUTE(x) __has_attribute(x)
#else
#define EIGEN_HAS_ATTRIBUTE(x) 0
#endif
// A Clang feature extension to determine compiler features.
// We use it to determine 'cxx_rvalue_references'
#ifndef __has_feature
@@ -831,7 +838,7 @@
#endif
// Does the compiler support vector types?
#if __has_attribute(ext_vector_type) && __has_builtin(__builtin_vectorelements)
#if EIGEN_HAS_ATTRIBUTE(ext_vector_type) && EIGEN_HAS_BUILTIN(__builtin_vectorelements)
#define EIGEN_ARCH_VECTOR_EXTENSIONS 1
#else
#define EIGEN_ARCH_VECTOR_EXTENSIONS 0