This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] [PR19163] Fix attribute aligned on dependent arraytypes
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 04 Jan 2005 02:00:19 +0100
- Subject: Re: [C++ PATCH] [PR19163] Fix attribute aligned on dependent arraytypes
- References: <022201c4ec60$62d4b820$394e2597@bagio> <20041227225753.GC5386@redhat.com> <031101c4ecc7$b1c21470$394e2597@bagio> <41D9A1B1.3030302@codesourcery.com> <41D9C06C.6090407@suse.de>
Paolo Carlini wrote:
In the meanwhile, for 4.0, as far as tr1::type_traits::aligned_storage
is concerned, probably I can devise a work-around, as per the
implementation note 4.8, thus using __alignof__...
Like this, roughly, but probably I will not be able to finalize the 4.0
version of
alignment_of and aligned_storage before next week (a few days off,
finally... ;)
template<std::size_t, std::size_t>
struct aligned_storage;
template<std::size_t _Len>
struct aligned_storage<_Len, 1>
{
union type
{
unsigned char __data[_Len];
char __align __attribute__((aligned(1)));
};
};
template<std::size_t _Len>
struct aligned_storage<_Len, 2>
{
union type
{
unsigned char __data[_Len];
char __align __attribute__((aligned(2)));
};
};
template<std::size_t _Len>
struct aligned_storage<_Len, 4>
{
union type
{
unsigned char __data[_Len];
char __align __attribute__((aligned(4)));
};
};
template<std::size_t _Len>
struct aligned_storage<_Len, 8>
{
union type
{
unsigned char __data[_Len];
char __align __attribute__((aligned(8)));
};
};
template<std::size_t _Len>
struct aligned_storage<_Len, 16>
{
union type
{
unsigned char __data[_Len];
char __align __attribute__((aligned(16)));
};
};
template<std::size_t _Len>
struct aligned_storage<_Len, 32>
{
union type
{
unsigned char __data[_Len];
char __align __attribute__((aligned(32)));
};
};
Paolo.