This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Exporting structure layout
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 11 May 2005 22:12:26 +0200
- Subject: Re: Exporting structure layout
- References: <87d5rx4rzu.fsf@deneb.enyo.de> <d5thbe$bnr$1@sea.gmane.org>
* Paolo Bonzini:
>> Additional members are permitted, and the fields can be order. In
>> order to create a portable Ada interface, I have to write a short C
>> program which uses sizeof and offsetof to extract the structure
>> layout. In theory, it is possible to create compile-time-only tests
>> suitable for cross-compilation (compile-time constant expressions,
>> invalid zero-length arrays, and a binary search), but this is rather
>> messy.
>
> Look at AC_COMPUTE_INT.
This is exactly the thing I'm scared of. 8-)
> It should be easy to start from there and do a macro like
>
> GCC_COMPUTE_MEMBERS_SIZE_OFFSET([#include <poll.h>],
> [struct pollfd],
> [fd events revents]).
If we'd use such a macro to extract values of various E* constants,
bootstrap times would increase significantly, even while not
cross-compiling. That's why I think it's not a viable approach.