[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] build fix: xen on NetBSD/amd64
From: |
malc |
Subject: |
Re: [Qemu-devel] [PATCH] build fix: xen on NetBSD/amd64 |
Date: |
Fri, 10 Jul 2009 19:22:04 +0400 (MSD) |
On Fri, 10 Jul 2009, Christoph Egger wrote:
> On Friday 10 July 2009 12:18:39 malc wrote:
> > On Fri, 10 Jul 2009, Christoph Egger wrote:
> > > On Thursday 09 July 2009 21:21:06 Anthony Liguori wrote:
> > > > Christoph Egger wrote:
> > > > > Hi!
> > > > >
> > > > > Attached patch fixes this build error on NetBSD/amd64:
> > > > >
> > > > > hw/xen_blkif.h:20: warning: #pragma pack(psuh[, id], <n>) is not
> > > > > supported on this target
> > > > > hw/xen_blkif.h:36: warning: #pragma pack(pop[, id], <n>) is not
> > > > > supported on this target
> > > > >
> > > > > Signed-off-by: Christoph Egger <address@hidden>
> > > >
> > > > You'll invoke the fury of malc for introducing an identifier that
> > > > begins with '__' :-)
> > >
> > > In NetBSD, there is this in <sys/cdefs.h> :
> > >
> > > #if __GNUC_PREREQ__(2, 7)
> > > #define __packed __attribute__((__packed__))
> > > #define __aligned(x) __attribute__((__aligned__(x)))
> > > #define __section(x) __attribute__((__section__(x)))
> > > #elif defined(__PCC__)
> > > #define __packed _Pragma("packed 1")
> > > #define __aligned(x) _Pragma("aligned " __STRING(x))
> > > #define __section(x) _Pragma("section " ## x)
> > > #elif defined(__lint__)
> > > #define __packed /* delete */
> > > #define __aligned(x) /* delete */
> > > #define __section(x) /* delete */
> > > #else
> > > #define __packed error: no __packed for this compiler
> > > #define __aligned(x) error: no __aligned for this compiler
> > > #define __section(x) error: no __section for this compiler
> > > #endif
> > >
> > > > There really isn't pragma pack on NetBSD? That's ashame.
> > >
> > > No. Above defines are sufficient and portable.
> >
> > Above defines are sufficient but not anywhere near portable.
>
> Well, across different compilers, they are.
What i meant is that they (the system provider) are free to do that,
you (the user) can not do that though.
>
> > > Now you know where the __aligned define in my patch comes from. :-)
> >
> > You should conditionally include include sys/cdefs.h on NetBSD and not
> > defining your own version of __aligned (which is forbidden by the
> > standard).
>
> sys/cdefs.h is included implicitely by any libc standard header on NetBSD.
> No need for an #ifdef __NetBSD__ ... #endif for this.
Then i actually fail to see how your original patch is supposed to work
at all, gcc should raise hell about redefinition of __aligned.
> > Few more points:
> >
> > a. the file in question already uses aligned attribute _inside_ the
> > structures without any macros
>
> So the pragmas have no effect then ? If so, then just remove them.
Not really, the individual members are marked with attribute aligned
(just take a look), not the whole structures.
>
> > b. unlike all other xen* files the header guard is __XEN_BLKIF_H__
> > and not QEMU_XEN_BLKIF_H (that should be fixed too)
>
> Easy to fix. Will you do or should I send a diff ?
>
That would be very nice of you.
--
mailto:address@hidden
Re: [Qemu-devel] [PATCH] build fix: xen on NetBSD/amd64, Anthony Liguori, 2009/07/10