mirror of
https://github.com/boostorg/poly_collection.git
synced 2026-07-21 13:33:37 +00:00
refactored __attribute__ conditional insertion to cater for potential warnings
This commit is contained in:
@@ -73,6 +73,23 @@ public:
|
|||||||
explicit stride_iterator(DerivedValue* x)noexcept:
|
explicit stride_iterator(DerivedValue* x)noexcept:
|
||||||
p{x},stride_{sizeof(DerivedValue)}{}
|
p{x},stride_{sizeof(DerivedValue)}{}
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=40900)||\
|
||||||
|
BOOST_WORKAROUND(BOOST_CLANG,>=1)&&\
|
||||||
|
(__clang_major__>3 || __clang_major__==3 && __clang_minor__ >= 8)
|
||||||
|
/* https://github.com/boostorg/poly_collection/issues/15 */
|
||||||
|
|
||||||
|
#define BOOST_POLY_COLLECTION_NO_SANITIZE
|
||||||
|
|
||||||
|
/* UBSan seems not to be supported in some environments */
|
||||||
|
#if defined(BOOST_GCC_VERSION)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wattributes"
|
||||||
|
#elif defined(BOOST_CLANG)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wattributes"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
template<
|
template<
|
||||||
typename DerivedValue,
|
typename DerivedValue,
|
||||||
typename std::enable_if<
|
typename std::enable_if<
|
||||||
@@ -80,16 +97,22 @@ public:
|
|||||||
(!std::is_const<Value>::value||std::is_const<DerivedValue>::value)
|
(!std::is_const<Value>::value||std::is_const<DerivedValue>::value)
|
||||||
>::type* =nullptr
|
>::type* =nullptr
|
||||||
>
|
>
|
||||||
#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=40900)||\
|
#if defined(BOOST_POLY_COLLECTION_NO_SANITIZE)
|
||||||
BOOST_WORKAROUND(BOOST_CLANG,>=1)&&\
|
|
||||||
(__clang_major__>3 || __clang_major__==3 && __clang_minor__ >= 8)
|
|
||||||
/* https://github.com/boostorg/poly_collection/issues/15 */
|
|
||||||
|
|
||||||
__attribute__((no_sanitize("undefined")))
|
__attribute__((no_sanitize("undefined")))
|
||||||
#endif
|
#endif
|
||||||
explicit operator DerivedValue*()const noexcept
|
explicit operator DerivedValue*()const noexcept
|
||||||
{return static_cast<DerivedValue*>(p);}
|
{return static_cast<DerivedValue*>(p);}
|
||||||
|
|
||||||
|
#if defined(BOOST_POLY_COLLECTION_NO_SANITIZE)
|
||||||
|
#if defined(BOOST_GCC_VERSION)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#elif defined(BOOST_CLANG)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#undef BOOST_POLY_COLLECTION_NO_SANITIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
std::size_t stride()const noexcept{return stride_;}
|
std::size_t stride()const noexcept{return stride_;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user