[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 02/18] qxl: switch to constants within BUILD_BUG_O
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 02/18] qxl: switch to constants within BUILD_BUG_ON |
Date: |
Thu, 26 Jan 2017 18:15:10 +0200 |
We are switching BUILD_BUG_ON to verify that it's parameter is a
compile-time constant, and it turns out that some gcc versions
(specifically gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609) are
not smart enough to figure it out for expressions involving local
variables. This is harmless but means that the check is ineffective for
these platforms. To fix, replace variables with macros.
Reported-by: Peter Maydell <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
hw/display/qxl.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 62d0c80..af4c0ca 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -306,12 +306,11 @@ void qxl_spice_reset_cursor(PCIQXLDevice *qxl)
static ram_addr_t qxl_rom_size(void)
{
- uint32_t required_rom_size = sizeof(QXLRom) + sizeof(QXLModes) +
- sizeof(qxl_modes);
- uint32_t rom_size = 8192; /* two pages */
+#define QXL_REQUIRED_SZ (sizeof(QXLRom) + sizeof(QXLModes) + sizeof(qxl_modes))
+#define QXL_ROM_SZ 8192
- QEMU_BUILD_BUG_ON(required_rom_size > rom_size);
- return rom_size;
+ QEMU_BUILD_BUG_ON(QXL_REQUIRED_SZ > QXL_ROM_SZ);
+ return QXL_ROM_SZ;
}
static void init_qxl_rom(PCIQXLDevice *d)
--
MST
- [Qemu-devel] [PULL v2 00/18] virtio, vhost, pci: fixes, features, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 02/18] qxl: switch to constants within BUILD_BUG_ON,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 01/18] compiler: drop ; after BUILD_BUG_ON, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 03/18] compiler: rework BUG_ON using a struct, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 04/18] compiler: expression version of QEMU_BUILD_BUG_ON, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 05/18] ARRAY_SIZE: check that argument is an array, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 06/18] pci: mark ROMs read-only, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 07/18] intel_iommu: fix and simplify size calculation in process_device_iotlb_desc(), Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 08/18] hw/pcie: Introduce a base class for PCI Express Root Ports, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 09/18] hw/ioh3420: derive from PCI Express Root Port base class, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 11/18] hw/i386: check if nvdimm is enabled before plugging, Michael S. Tsirkin, 2017/01/26
- [Qemu-devel] [PULL v2 12/18] msix: Follow CODING_STYLE, Michael S. Tsirkin, 2017/01/26