Skip to contentSkip to conversation

disas/libvixl: Suppress gcc 4.6.3 sign-compare warnings

PATCH In review Peter Maydell 2 participants 4 messages Jan 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disas/libvixl: Suppress gcc 4.6.3 sign-compare warnings

The VIXL code includes some equality comparisons between signed and unsigned types. Modern gcc and clang do not complain about these, but older versions of gcc such as gcc 4.6.3 do. Since libvixl is an upstream library, the simplest approach is to suppress the warnings by applying -Wno-sign-compare to the relevant files.

(GCC 4.6 is not quite yet irrelevant for us; it is the gcc shipped with Ubuntu Precise, for example, which is an LTS release not yet out of its support period.)

---
I had mistakenly thought these warnings only happened with the totally ancient mingw gcc, but it turns out they're a bit more widespread. In particular this is causing our Travis builds to fail:
https://travis-ci.org/qemu/qemu/jobs/101813358

If somebody could review this then I'll apply it to master as a buildfix.

---
 disas/Makefile.objs         | 5 ++++-
 disas/libvixl/Makefile.objs | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
disas/Makefile.objs +4 -1
index 8dae4da..abeba84 100644
@@ -4,7 +4,10 @@ common-obj-$(CONFIG_ARM_DIS) += arm.o
 common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o
 common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/
 libvixldir = $(SRC_PATH)/disas/libvixl
-arm-a64.o-cflags := -I$(libvixldir)
+# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
+# some signed-unsigned equality comparisons in libvixl which later gcc
+# versions do not.
+arm-a64.o-cflags := -I$(libvixldir) -Wno-sign-compare
 common-obj-$(CONFIG_CRIS_DIS) += cris.o
 common-obj-$(CONFIG_HPPA_DIS) += hppa.o
 common-obj-$(CONFIG_I386_DIS) += i386.o
disas/libvixl/Makefile.objs +3 -1
index e373cf0..d1e801a 100644
@@ -4,6 +4,8 @@ libvixl_OBJS = vixl/utils.o \
                vixl/a64/decoder-a64.o \
                vixl/a64/disasm-a64.o
 
-$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS)
+# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
+# some signed-unsigned equality comparisons which later gcc versions do not.
+$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl -Wno-sign-compare $(QEMU_CFLAGS)
 
 common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
Signature · 1 line
1.9.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Peter Maydell

The VIXL code includes some equality comparisons between signed and unsigned types. Modern gcc and clang do not complain about these, but older versions of gcc such as gcc 4.6.3 do. Since libvixl is an upstream library, the simplest approach is to suppress the warnings by applying -Wno-sign-compare to the relevant files.

(GCC 4.6 is not quite yet irrelevant for us; it is the gcc shipped with Ubuntu Precise, for example, which is an LTS release not yet out of its support period.)

---
I had mistakenly thought these warnings only happened with the totally ancient mingw gcc, but it turns out they're a bit more widespread. In particular this is causing our Travis builds to fail:
https://travis-ci.org/qemu/qemu/jobs/101813358

Quoted 2 lines

If somebody could review this then I'll apply it to master as a buildfix.

Quoted 26 lines
---
 disas/Makefile.objs         | 5 ++++-
 disas/libvixl/Makefile.objs | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
disas/Makefile.objs +4 -1
index 8dae4da..abeba84 100644
@@ -4,7 +4,10 @@ common-obj-$(CONFIG_ARM_DIS) += arm.o
 common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o
 common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/
 libvixldir = $(SRC_PATH)/disas/libvixl
-arm-a64.o-cflags := -I$(libvixldir)
+# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
+# some signed-unsigned equality comparisons in libvixl which later gcc
+# versions do not.
+arm-a64.o-cflags := -I$(libvixldir) -Wno-sign-compare
 common-obj-$(CONFIG_CRIS_DIS) += cris.o
 common-obj-$(CONFIG_HPPA_DIS) += hppa.o
 common-obj-$(CONFIG_I386_DIS) += i386.o
disas/libvixl/Makefile.objs +0 -0
index e373cf0..d1e801a 100644

disas/libvixl/Makefile.objs libvixl_OBJS = vixl/utils.o \ · line 11

Quoted 9 lines
disas/libvixl/Makefile.objs +3 -1
@@ -4,6 +4,8 @@ libvixl_OBJS = vixl/utils.o \
                vixl/a64/decoder-a64.o \
                vixl/a64/disasm-a64.o
 
-$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS)
+# The -Wno-sign-compare is needed only for gcc 4.6, which complains about
+# some signed-unsigned equality comparisons which later gcc versions do not.
+$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl -Wno-sign-compare $(QEMU_CFLAGS)
 
 common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)

--
Alex Bennée

#2 lore raw
Quoted 22 lines · Alex Bennée
Quoted 19 lines · Peter Maydell

The VIXL code includes some equality comparisons between signed and unsigned types. Modern gcc and clang do not complain about these, but older versions of gcc such as gcc 4.6.3 do. Since libvixl is an upstream library, the simplest approach is to suppress the warnings by applying -Wno-sign-compare to the relevant files.

(GCC 4.6 is not quite yet irrelevant for us; it is the gcc shipped with Ubuntu Precise, for example, which is an LTS release not yet out of its support period.)

---
I had mistakenly thought these warnings only happened with the totally ancient mingw gcc, but it turns out they're a bit more widespread. In particular this is causing our Travis builds to fail:
https://travis-ci.org/qemu/qemu/jobs/101813358

Quoted 4 lines
Quoted 2 lines

If somebody could review this then I'll apply it to master as a buildfix.

Thanks; applied to master.

-- PMM

#3 lore raw
Quoted 23 lines · Peter Maydell
Quoted 22 lines · Alex Bennée
Quoted 19 lines · Peter Maydell

The VIXL code includes some equality comparisons between signed and unsigned types. Modern gcc and clang do not complain about these, but older versions of gcc such as gcc 4.6.3 do. Since libvixl is an upstream library, the simplest approach is to suppress the warnings by applying -Wno-sign-compare to the relevant files.

(GCC 4.6 is not quite yet irrelevant for us; it is the gcc shipped with Ubuntu Precise, for example, which is an LTS release not yet out of its support period.)

---
I had mistakenly thought these warnings only happened with the totally ancient mingw gcc, but it turns out they're a bit more widespread. In particular this is causing our Travis builds to fail:
https://travis-ci.org/qemu/qemu/jobs/101813358

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

If somebody could review this then I'll apply it to master as a buildfix.

Thanks; applied to master.

Unfortunately it doesn't seem to actually fix the travis build; not sure why...
https://travis-ci.org/qemu/qemu/jobs/101902544

-- PMM