qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] SLIRP warning messages displayed while compiling


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] SLIRP warning messages displayed while compiling
Date: Sat, 12 Aug 2017 12:38:37 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Hi Eric,

On 08/12/2017 08:41 AM, Eric Blake wrote:
Here's an idea:  Instead of using struct ip6 { ... } QEMU_PACKED, use

struct ip6 {
...
};
QEMU_BUG_ON(sizeof(struct ip6) != 32);

so that the compiler explicitly chokes if it introduced any padding, and
then we know all our accesses are naturally aligned which shuts up the
warning.

Following your suggestion I tried:

#define QEMU_BUG_STRUCT_UNALIGNED(s) \
        QEMU_BUILD_BUG_ON(sizeof(s) != sizeof(s QEMU_PACKED))

QEMU_BUG_STRUCT_UNALIGNED(struct ip6);

but this gives:

qemu/slirp/ip6.h:157:1: warning: 'packed' attribute ignored when parsing type [-Wignored-attributes]
QEMU_BUG_STRUCT_UNALIGNED(struct ip6);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
qemu/slirp/ip6.h:155:49: note: expanded from macro 'QEMU_BUG_STRUCT_UNALIGNED'
        QEMU_BUILD_BUG_ON(sizeof(s) != sizeof(s QEMU_PACKED))
                                                ^~~~~~~~~~~
qemu/include/qemu/compiler.h:40:37: note: expanded from macro 'QEMU_PACKED'
# define QEMU_PACKED __attribute__((packed))
                                    ^~~~~~
1 warning generated.



reply via email to

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