qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] linux-user: correctly align types in thunking c


From: Laurent Vivier
Subject: Re: [Qemu-devel] [PATCH] linux-user: correctly align types in thunking code
Date: Sat, 08 Dec 2012 18:13:17 +0100

Le samedi 08 décembre 2012 à 17:55 +0100, Andreas Färber a écrit :
> Am 08.12.2012 16:18, schrieb Laurent Vivier:
> > Signed-off-by: Laurent Vivier <address@hidden>
> > ---
> >  thunk.h |   22 +++++++++++++++++-----
> >  1 file changed, 17 insertions(+), 5 deletions(-)
> > 
> > diff --git a/thunk.h b/thunk.h
> > index 87025c3..d3e9f3d 100644
> > --- a/thunk.h
> > +++ b/thunk.h
> > @@ -151,20 +151,32 @@ static inline int thunk_type_align(const argtype 
> > *type_ptr, int is_host)
> >      case TYPE_CHAR:
> >          return 1;
> >      case TYPE_SHORT:
> > -        return 2;
> > +        if (is_host) {
> > +            return __alignof__(short);
> 
> Might __alignof__() depend on a certain GCC version? Is it supported by
> clang?

I'm a big fan of copy&paste: I took them from linux-user/syscall.c :

static const StructEntry struct_termios_def = {
    .convert = { host_to_target_termios, target_to_host_termios },
    .size = { sizeof(struct target_termios), sizeof(struct host_termios) },
    .align = { __alignof__(struct target_termios), __alignof__(struct 
host_termios) },
};

Regards,
Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]