qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/3] util: remove redundant include of glib.h


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 3/3] util: remove redundant include of glib.h
Date: Wed, 6 Jun 2018 19:31:53 +0100

On 6 June 2018 at 18:32, Daniel P. Berrangé <address@hidden> wrote:
> Code must only ever include glib.h indirectly via the glib-compat.h
> header file, because we will need some macros set before glib.h is
> pulled in. Adding extra includes of glib.h will (soon) cause compile
> failures such as:
>
> In file included from /home/berrange/src/virt/qemu/include/qemu/osdep.h:107,
>                  from 
> /home/berrange/src/virt/qemu/include/qemu/iova-tree.h:26,
>                  from util/iova-tree.c:13:
> /home/berrange/src/virt/qemu/include/glib-compat.h:22: error: 
> "GLIB_VERSION_MIN_REQUIRED" redefined [-Werror]
>  #define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_40
>
> In file included from /usr/include/glib-2.0/glib/gtypes.h:34,
>                  from /usr/include/glib-2.0/glib/galloca.h:32,
>                  from /usr/include/glib-2.0/glib.h:30,
>                  from util/iova-tree.c:12:
> /usr/include/glib-2.0/glib/gversionmacros.h:237: note: this is the location 
> of the previous definition
>  # define GLIB_VERSION_MIN_REQUIRED      (GLIB_VERSION_CUR_STABLE)
>
> Signed-off-by: Daniel P. Berrangé <address@hidden>
> ---
>  util/iova-tree.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/util/iova-tree.c b/util/iova-tree.c
> index 2d9cebfc89..d39cd8bb29 100644
> --- a/util/iova-tree.c
> +++ b/util/iova-tree.c
> @@ -9,7 +9,6 @@
>   * This work is licensed under the terms of the GNU GPL, version 2 or later.
>   */
>
> -#include <glib.h>
>  #include "qemu/iova-tree.h"

While we're fixing up the headers in this file:
it should start with an include of qemu/osdep.h,
and qemu/iova-tree.h should not include osdep.h...

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]