123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- /*
- * Distributed under the Boost Software License, Version 1.0.
- * (See accompanying file LICENSE_1_0.txt or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
- *
- * Copyright (c) 2020 Andrey Semashev
- */
- /*!
- * \file atomic/detail/aligned_variable.hpp
- *
- * This header defines a convenience macro for declaring aligned variables
- */
- #ifndef BOOST_ATOMIC_DETAIL_ALIGNED_VARIABLE_HPP_INCLUDED_
- #define BOOST_ATOMIC_DETAIL_ALIGNED_VARIABLE_HPP_INCLUDED_
- #include <boost/atomic/detail/config.hpp>
- alignas(var_alignment) var_type var_name
- alignas(var_alignment) var_type var_name
- // Note: Some compilers cannot use constant expressions in alignment attributes or alignas, so we have to use the union trick
- union \
- { \
- var_type var_name; \
- boost::type_with_alignment< var_alignment >::type BOOST_JOIN(var_name, _aligner); \
- }
- union \
- { \
- var_type var_name; \
- typename boost::type_with_alignment< var_alignment >::type BOOST_JOIN(var_name, _aligner); \
- }
|