From 42b3a3f111a3ca0055e425259f76d390485413de Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 26 Jan 2023 03:17:05 +0200 Subject: [PATCH] Use BOOST_CORE_ALIGNOF in boost/core/max_align.hpp --- include/boost/core/alignof.hpp | 6 +++--- include/boost/core/max_align.hpp | 30 ++---------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/include/boost/core/alignof.hpp b/include/boost/core/alignof.hpp index de1f01c..07ff444 100644 --- a/include/boost/core/alignof.hpp +++ b/include/boost/core/alignof.hpp @@ -1,5 +1,5 @@ -#ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED -#define BOOST_CORE_MAX_ALIGN_HPP_INCLUDED +#ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED +#define BOOST_CORE_ALIGNOF_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -54,4 +54,4 @@ template struct alignof_helper #endif -#endif // #ifndef BOOST_CORE_MAX_ALIGN_HPP_INCLUDED +#endif // #ifndef BOOST_CORE_ALIGNOF_HPP_INCLUDED diff --git a/include/boost/core/max_align.hpp b/include/boost/core/max_align.hpp index 12c2692..a5806d4 100644 --- a/include/boost/core/max_align.hpp +++ b/include/boost/core/max_align.hpp @@ -11,6 +11,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt +#include #include #include @@ -73,34 +74,7 @@ union max_align_t void (max_align_t::*pmf)(); }; -#if !defined(BOOST_NO_CXX11_ALIGNOF) - -BOOST_CONSTEXPR_OR_CONST std::size_t max_align = alignof( max_align_t ); - -#elif defined(__GNUC__) - -BOOST_CONSTEXPR_OR_CONST std::size_t max_align = __alignof__( max_align_t ); - -#elif defined(_MSC_VER) - -BOOST_CONSTEXPR_OR_CONST std::size_t max_align = __alignof( max_align_t ); - -#else - -namespace detail -{ - -struct alignment_of_helper -{ - char x; - max_align_t a; -}; - -} // namespace detail - -BOOST_CONSTEXPR_OR_CONST std::size_t max_align = offsetof( core::detail::alignment_of_helper, a ); - -#endif +BOOST_CONSTEXPR_OR_CONST std::size_t max_align = BOOST_CORE_ALIGNOF( max_align_t ); } // namespace core } // namespace boost