Order matters when using _pack_ attribute

"Tim Finer" <[email protected]> Tue, 19 Jul 2005 19:32:56 -0700 (PDT)
Newsgroups gmane.comp.python.ctypes.devel
Message-ID <45332.192.168.0.99.1121826776.squirrel@crypt>
Hello,

The following is a possible bug report.

Gccxml 0.7.0 doesn't like the following:

#if defined( __GNUC__ )
#  define GCC_PACK __attribute__ ((aligned (1),packed))
#endif

typedef struct AStruct {
// some stuff here
} GCC_PACK AStruct;

and errors out with:
error: syntax error before `__attribute__'
even though __attribute__ has been around in GCC for a long time.

I tested out adding _pack_ = 1 to the generated python code but found out
that it doesn't work unless it is added _before_ fields is defined.  My
expectation was that it was order independent.

OK, since I have lots and lots of these structs, I was determined to add a
command line option for global packing to xml2py, which I did.  Let me
know if you'd like it.  I commented out all of the assertions for size and
offset as I am using another method to verify everything.

Please reply via email as I haven't subscribed.

Regards,
Tim



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click