This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: go32-nat, always a thread


> Date: Sat, 09 Aug 2008 21:54:20 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: Pedro Alves <pedro@codesourcery.com>
> > 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.

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.


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