qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers
@ 2016-07-19 14:04 Peter Maydell
  2016-07-19 14:17 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2016-07-19 14:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, BALATON Zoltan, Lluís Vilanova, Stefan Hajnoczi

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>
---
 disas/arm.c         | 1 -
 include/disas/bfd.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/disas/arm.c b/disas/arm.c
index 32f8ca9..426270f 100644
--- a/disas/arm.c
+++ b/disas/arm.c
@@ -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
diff --git a/include/disas/bfd.h b/include/disas/bfd.h
index 231e5fb..8a3488c 100644
--- a/include/disas/bfd.h
+++ b/include/disas/bfd.h
@@ -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 */
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers
  2016-07-19 14:04 [Qemu-devel] [PATCH] disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers Peter Maydell
@ 2016-07-19 14:17 ` Stefan Hajnoczi
  2016-07-19 16:50   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-07-19 14:17 UTC (permalink / raw)
  To: Peter Maydell
  Cc: qemu-devel, BALATON Zoltan, Lluís Vilanova, Stefan Hajnoczi,
	patches

[-- Attachment #1: Type: text/plain, Size: 843 bytes --]

On Tue, Jul 19, 2016 at 03:04:36PM +0100, Peter Maydell wrote:
> 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>
> ---
>  disas/arm.c         | 1 -
>  include/disas/bfd.h | 2 ++
>  2 files changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers
  2016-07-19 14:17 ` Stefan Hajnoczi
@ 2016-07-19 16:50   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2016-07-19 16:50 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: QEMU Developers, BALATON Zoltan, Lluís Vilanova,
	Stefan Hajnoczi, Patch Tracking

On 19 July 2016 at 15:17, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Tue, Jul 19, 2016 at 03:04:36PM +0100, Peter Maydell wrote:
>> 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>
>> ---
>>  disas/arm.c         | 1 -
>>  include/disas/bfd.h | 2 ++
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Thanks; applied to master as a buildfix.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-19 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-19 14:04 [Qemu-devel] [PATCH] disas: Fix ATTRIBUTE_UNUSED define clash with ALSA headers Peter Maydell
2016-07-19 14:17 ` Stefan Hajnoczi
2016-07-19 16:50   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).