|
44 | 44 | */
|
45 | 45 |
|
46 | 46 | #include <pcl/type_traits.h> // for has_custom_allocator
|
| 47 | +#include <pcl/pcl_config.h> // for PCL_USES_EIGEN_HANDMADE_ALIGNED_MALLOC |
47 | 48 |
|
48 | 49 | #include <Eigen/Core> // for EIGEN_MAKE_ALIGNED_OPERATOR_NEW
|
49 | 50 |
|
50 | 51 | #include <memory> // for std::allocate_shared, std::dynamic_pointer_cast, std::make_shared, std::shared_ptr, std::static_pointer_cast, std::weak_ptr
|
51 | 52 | #include <type_traits> // for std::enable_if_t, std::false_type, std::true_type
|
52 | 53 | #include <utility> // for std::forward
|
53 | 54 |
|
| 55 | +#if !defined(PCL_SILENCE_MALLOC_WARNING) |
| 56 | +#if PCL_USES_EIGEN_HANDMADE_ALIGNED_MALLOC |
| 57 | +// EIGEN_DEFAULT_ALIGN_BYTES and EIGEN_MALLOC_ALREADY_ALIGNED will be set after including Eigen/Core |
| 58 | +// this condition is the same as in the function aligned_malloc in Memory.h in the Eigen code |
| 59 | +#if (defined(EIGEN_DEFAULT_ALIGN_BYTES) && EIGEN_DEFAULT_ALIGN_BYTES==0) || (defined(EIGEN_MALLOC_ALREADY_ALIGNED) && EIGEN_MALLOC_ALREADY_ALIGNED) |
| 60 | +#if defined(_MSC_VER) |
| 61 | +#error "Potential runtime error due to aligned malloc mismatch! You likely have to compile your code with AVX enabled or define EIGEN_MAX_ALIGN_BYTES=32 (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)" |
| 62 | +#else // defined(_MSC_VER) |
| 63 | +#warning "Potential runtime error due to aligned malloc mismatch! You likely have to compile your code with AVX enabled or define EIGEN_MAX_ALIGN_BYTES=32 (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)" |
| 64 | +#endif // defined(_MSC_VER) |
| 65 | +#endif |
| 66 | +#else // PCL_USES_EIGEN_HANDMADE_ALIGNED_MALLOC |
| 67 | +#if (defined(EIGEN_DEFAULT_ALIGN_BYTES) && EIGEN_DEFAULT_ALIGN_BYTES!=0) && (defined(EIGEN_MALLOC_ALREADY_ALIGNED) && !EIGEN_MALLOC_ALREADY_ALIGNED) |
| 68 | +#if defined(_MSC_VER) |
| 69 | +#error "Potential runtime error due to aligned malloc mismatch! PCL was likely compiled without AVX support but you enabled AVX for your code (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)" |
| 70 | +#else // defined(_MSC_VER) |
| 71 | +#warning "Potential runtime error due to aligned malloc mismatch! PCL was likely compiled without AVX support but you enabled AVX for your code (to silence this message at your own risk, define PCL_SILENCE_MALLOC_WARNING=1)" |
| 72 | +#endif // defined(_MSC_VER) |
| 73 | +#endif |
| 74 | +#endif // PCL_USES_EIGEN_HANDMADE_ALIGNED_MALLOC |
| 75 | +#endif // !defined(PCL_SILENCE_MALLOC_WARNING) |
| 76 | + |
54 | 77 | /**
|
55 | 78 | * \brief Macro to signal a class requires a custom allocator
|
56 | 79 | *
|
|
0 commit comments