On Saturday 09 August 2008 19:54:20, Eli Zaretskii wrote: > > From: Pedro Alves > > Date: Sat, 9 Aug 2008 18:53:44 +0100 > > > > GCC complains about attribute packed like so: > > > > cc1.exe: warnings being treated as errors > > ../../gdb/go32-nat.c:1292: warning: 'packed' attribute ignored for field > > of type 'unsigned char' ../../gdb/go32-nat.c:1301: warning: 'packed' > > attribute ignored for field of type 'unsigned char' > > This one is the only one that bother me a little, since these > structures need to match the memory layouts expected by the system > calls to which we pass them. Does the warning mean that GCC will > never add any padding between the previous field and the `unsigned > char' field? If so, the change is safe; if not, we need to find some > way of enforcing the no-padding layouts. > On Saturday 09 August 2008 20:16:09, Mark Kettenis wrote: > Instead of > > struct foo { > char c __attribute__((packed)); > int d __attribute__((packed)); > }; > > you can (should?) write > > struct foo { > char c; > int d; > } __attribute__((packed)); > > I think that'll get rid of the warning. I considered changing it that way, but resisted because I assumed there was some obscure reason this wasn't done this way, that I was just failing to see. I've always used the latter form. Indeed, from GDB's manual: "Specifying this attribute for struct and union types is equivalent to specifying the packed attribute on each of the structure or union members." > The go32-nat.c changes are fine with me. Thanks, I've checked in the go32-nat.c changes, as attached. I'll post the rest of the changes in another thread. -- Pedro Alves