This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use ATTRIBUTE_PACKED in ree.c


On 22/11/12 07:52, Jakub Jelinek wrote:
On Thu, Nov 22, 2012 at 12:26:01AM +0100, Eric Botcazou wrote:
2012-11-21 Jakub Jelinek <jakub@redhat.com>

* ree.c (struct ext_modified): Add ATTRIBUTE_PACKED.

Are you sure that this will compile with non-GCC compilers?

I'm not sure, but I hope it will. ansidecl.h has #ifndef GCC_VERSION #define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) #endif /* GCC_VERSION */ ... #if (GCC_VERSION < 2007) # define __attribute__(x) #endif ... #ifndef ATTRIBUTE_PACKED # define ATTRIBUTE_PACKED __attribute__ ((packed)) #endif

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.

Jakub


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 :-(

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]