This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Use ATTRIBUTE_PACKED in ree.c
On 28/11/12 15:05, Jakub Jelinek wrote:
On Wed, Nov 28, 2012 at 03:02:12PM +0000, Richard Earnshaw wrote:
#if (GCC_VERSION < 2007)
# define __attribute__(x)
# define ATTRIBUTE_PACKED __attribute__ ((packed))
So in theory it should expand to nothing for non-GCC compilers.
I've tested (on a short testcase matching what the decl does)
GCCs from 4.8 down back to 3.2 (we support 4.1+ only anyway now)
and clang 3.0.
That's not going to help if those other compilers need packedness to
eliminate padding. The /old/ ARM ABI used to require that all
structs were padded out to 32 bits.
It looks to me as though this code is just non-portable and as such
needs to be rewritten :-(
Why? There is no hard requirement that this must be 2 byte long instead of
4, it is a pure optimization, don't want to waste too much memory
Ah, OK. I read your mail as implying that it didn't work when it wasn't
2 bytes long...