From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzlC5-0002NG-AZ for qemu-devel@nongnu.org; Tue, 02 Jun 2015 08:21:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YzlC2-0001wu-53 for qemu-devel@nongnu.org; Tue, 02 Jun 2015 08:21:21 -0400 Received: from mail-ig0-f176.google.com ([209.85.213.176]:36069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YzlC2-0001wi-1X for qemu-devel@nongnu.org; Tue, 02 Jun 2015 08:21:18 -0400 Received: by igbpi8 with SMTP id pi8so84721758igb.1 for ; Tue, 02 Jun 2015 05:21:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <556D5BD8.5040307@de.ibm.com> References: <1433166716-36861-1-git-send-email-mimu@linux.vnet.ibm.com> <556D5BD8.5040307@de.ibm.com> From: Peter Maydell Date: Tue, 2 Jun 2015 13:20:57 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] virtio-input: const_le16 and const_le32 not build time constant List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger Cc: Gerd Hoffmann , Michael Mueller , QEMU Developers On 2 June 2015 at 08:31, Christian Borntraeger wro= te: > Am 01.06.2015 um 15:51 schrieb Michael Mueller: >> As the implementation of const_le16 and const_le32 is not build time con= stant >> on big endian systems this need to be fixed. >> >> CC hw/input/virtio-input-hid.o >> hw/input/virtio-input-hid.c:340:13: error: initializer element is not co= nstant >> hw/input/virtio-input-hid.c:340:13: error: (near initialization for =E2= =80=98virtio_keyboard_config[1].u.ids.bustype=E2=80=99) >> ... >> >> Signed-off-by: Michael Mueller >> --- >> include/hw/virtio/virtio-input.h | 10 ++++++++-- >> 1 file changed, 8 insertions(+), 2 deletions(-) >> >> diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio= -input.h >> index a265519..bcee355 100644 >> --- a/include/hw/virtio/virtio-input.h >> +++ b/include/hw/virtio/virtio-input.h >> @@ -14,8 +14,14 @@ typedef struct virtio_input_config virtio_input_confi= g; >> typedef struct virtio_input_event virtio_input_event; >> >> #if defined(HOST_WORDS_BIGENDIAN) >> -# define const_le32(_x) bswap32(_x) >> -# define const_le16(_x) bswap32(_x) >> +# define const_le32(_x) \ >> + (((_x & 0x000000ffU) << 24) | \ >> + ((_x & 0x0000ff00U) << 8) | \ >> + ((_x & 0x00ff0000U) >> 8) | \ >> + ((_x & 0xff000000U) >> 24)) >> +# define const_le16(_x) \ >> + (((_x & 0x00ff) << 8) | \ >> + ((_x & 0xff00) >> 8)) >> #else >> # define const_le32(_x) (_x) >> # define const_le16(_x) (_x) >> > > Would be good to have this fixed soon. > I cannot build current qemu/master on s390. This patch fixes it for me. > An alternative solution might be to not use const_le* in the code. Should now be fixed in master. -- PMM