mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Merge pull request #149 from azat-ch/small-vector-msan
Use std::vector instead of boost::container::small_vector under MSan
This commit is contained in:
commit
38431d1117
@ -29,7 +29,11 @@
|
||||
#ifndef UTIL_SMALL_VECTOR_H
|
||||
#define UTIL_SMALL_VECTOR_H
|
||||
|
||||
#include <vector>
|
||||
#if defined(__has_feature)
|
||||
# if __has_feature(memory_sanitizer)
|
||||
#define BUILD_WITH_MSAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <boost/version.hpp>
|
||||
|
||||
@ -37,8 +41,16 @@
|
||||
* We use the small_vector constructors introduced in Boost 1.61 (trac bug
|
||||
* #11866, github commit b436c91). If the Boost version is too old, we fall
|
||||
* back to using std::vector.
|
||||
*
|
||||
* Also with MSan boost::container::small_vector cannot be used because MSan
|
||||
* reports some issues there, it looks similar to [1], but even adding
|
||||
* __attribute__((no_sanitize_memory)) for ~small_vector_base() [2] is not
|
||||
* enough since clang-16, so let's simply use std::vector under MSan.
|
||||
*
|
||||
* [1]: https://github.com/google/sanitizers/issues/854
|
||||
* [2]: https://github.com/ClickHouse/boost/commit/229354100
|
||||
*/
|
||||
#if BOOST_VERSION >= 106100
|
||||
#if !defined(BUILD_WITH_MSAN) && BOOST_VERSION >= 106100
|
||||
# define HAVE_BOOST_CONTAINER_SMALL_VECTOR
|
||||
#endif
|
||||
|
||||
@ -56,6 +68,8 @@ using small_vector = boost::container::small_vector<T, N, Allocator>;
|
||||
|
||||
#else
|
||||
|
||||
#include <vector>
|
||||
|
||||
// Boost version isn't new enough, fall back to just using std::vector.
|
||||
template <class T, std::size_t N, typename Allocator = std::allocator<T>>
|
||||
using small_vector = std::vector<T, Allocator>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user