disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 19 Jul 2016 14:04:36 +0000 (15:04 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 19 Jul 2016 15:40:39 +0000 (16:40 +0100)
disas/bfd.h defines ATTRIBUTE_UNUSED, but unfortunately the
ALSA system headers also define this macro, which means that
you can get a compilation failure if building with ALSA and
any files happen to include the alsa headers before bfd.h
rather than the other way around.

This is unfortunate namespace pollution by the ALSA headers but
we can work around it. Add an #ifndef guard to bfd.h and remove
the unnecessary extra definition in disas/arm.c to fix this.

Reported-by: BALATON Zoltan <balaton@eik.bme.hu>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1468937076-21503-1-git-send-email-peter.maydell@linaro.org

disas/arm.c
include/disas/bfd.h

index 32f8ca992ffb9fd505f0d837e87052da206f5fa0..426270fe829249b4f5ea54737f739fac637fbb43 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "qemu/osdep.h"
 #include "disas/bfd.h"
-#define ATTRIBUTE_UNUSED __attribute__((unused))
 #define ISSPACE(x) ((x) == ' ' || (x) == '\t' || (x) == '\n')
 
 #define ARM_EXT_V1      0
index 231e5fbf9133e32d76a5760d86c51f47fbb157b0..8a3488c2c5155a0c59d10685f673201745e41961 100644 (file)
@@ -477,7 +477,9 @@ int generic_symbol_at_address(bfd_vma, struct disassemble_info *);
   (INFO).disassembler_options = NULL, \
   (INFO).insn_info_valid = 0
 
+#ifndef ATTRIBUTE_UNUSED
 #define ATTRIBUTE_UNUSED __attribute__((unused))
+#endif
 
 /* from libbfd */