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é <berrange@redhat.com>
---
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"
struct IOVATree {
--
2.17.0
On 06/06/2018 02:32 PM, Daniel P. Berrangé 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é <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> 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"
>
> struct IOVATree {
>
On 6 June 2018 at 18:32, Daniel P. Berrangé <berrange@redhat.com> 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é <berrange@redhat.com> > --- > 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
On Wed, Jun 06, 2018 at 07:31:53PM +0100, Peter Maydell wrote: > On 6 June 2018 at 18:32, Daniel P. Berrangé <berrange@redhat.com> 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é <berrange@redhat.com> > > --- > > 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... Sorry to messed this up. It was used for hwaddr definition. Maybe we can just replace hwaddr usage in iova-tree.[ch] with something like uint64_t? Then I think we can drop the osdep.h. Regards, -- Peter Xu
Peter Xu <peterx@redhat.com> writes: > On Wed, Jun 06, 2018 at 07:31:53PM +0100, Peter Maydell wrote: >> On 6 June 2018 at 18:32, Daniel P. Berrangé <berrange@redhat.com> 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é <berrange@redhat.com> >> > --- >> > 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... > > Sorry to messed this up. It was used for hwaddr definition. > > Maybe we can just replace hwaddr usage in iova-tree.[ch] with > something like uint64_t? Then I think we can drop the osdep.h. Every compilation unit must include "osdep.h" first. Its file comment explains why. If it's insufficiently convincing, we should fix it :)
On Thu, Jun 07, 2018 at 09:05:28AM +0200, Markus Armbruster wrote: > Peter Xu <peterx@redhat.com> writes: > > > On Wed, Jun 06, 2018 at 07:31:53PM +0100, Peter Maydell wrote: > >> On 6 June 2018 at 18:32, Daniel P. Berrangé <berrange@redhat.com> 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é <berrange@redhat.com> > >> > --- > >> > 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... > > > > Sorry to messed this up. It was used for hwaddr definition. > > > > Maybe we can just replace hwaddr usage in iova-tree.[ch] with > > something like uint64_t? Then I think we can drop the osdep.h. > > Every compilation unit must include "osdep.h" first. Its file comment > explains why. If it's insufficiently convincing, we should fix it :) Ah... :) Then maybe also we can let iova-tree.c to include osdep.h (instead of glib.h), and remove that line in iova-tree.h Thanks, -- Peter Xu
On Thu, Jun 07, 2018 at 03:44:56PM +0800, Peter Xu wrote: > On Thu, Jun 07, 2018 at 09:05:28AM +0200, Markus Armbruster wrote: > > Peter Xu <peterx@redhat.com> writes: > > > > > On Wed, Jun 06, 2018 at 07:31:53PM +0100, Peter Maydell wrote: > > >> On 6 June 2018 at 18:32, Daniel P. Berrangé <berrange@redhat.com> 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é <berrange@redhat.com> > > >> > --- > > >> > 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... > > > > > > Sorry to messed this up. It was used for hwaddr definition. > > > > > > Maybe we can just replace hwaddr usage in iova-tree.[ch] with > > > something like uint64_t? Then I think we can drop the osdep.h. > > > > Every compilation unit must include "osdep.h" first. Its file comment > > explains why. If it's insufficiently convincing, we should fix it :) > > Ah... :) > > Then maybe also we can let iova-tree.c to include osdep.h (instead of > glib.h), and remove that line in iova-tree.h Yeah, I'll repost with that changed Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
On Thu, Jun 07, 2018 at 09:26:51AM +0100, Daniel P. Berrangé wrote: > On Thu, Jun 07, 2018 at 03:44:56PM +0800, Peter Xu wrote: > > On Thu, Jun 07, 2018 at 09:05:28AM +0200, Markus Armbruster wrote: > > > Peter Xu <peterx@redhat.com> writes: > > > > > > > On Wed, Jun 06, 2018 at 07:31:53PM +0100, Peter Maydell wrote: > > > >> On 6 June 2018 at 18:32, Daniel P. Berrangé <berrange@redhat.com> 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é <berrange@redhat.com> > > > >> > --- > > > >> > 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... > > > > > > > > Sorry to messed this up. It was used for hwaddr definition. > > > > > > > > Maybe we can just replace hwaddr usage in iova-tree.[ch] with > > > > something like uint64_t? Then I think we can drop the osdep.h. > > > > > > Every compilation unit must include "osdep.h" first. Its file comment > > > explains why. If it's insufficiently convincing, we should fix it :) > > > > Ah... :) > > > > Then maybe also we can let iova-tree.c to include osdep.h (instead of > > glib.h), and remove that line in iova-tree.h > > Yeah, I'll repost with that changed Thanks for fixing that! -- Peter Xu
On 06.06.2018 19:32, Daniel P. Berrangé 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) In case you respin this series, should the order of patch 2 and 3 be swapped? ... so that we keep the tree bisectable? Thomas
On Thu, Jun 07, 2018 at 10:44:15AM +0200, Thomas Huth wrote: > On 06.06.2018 19:32, Daniel P. Berrangé 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) > > In case you respin this series, should the order of patch 2 and 3 be > swapped? ... so that we keep the tree bisectable? Yes it should be. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
© 2016 - 2026 Red Hat, Inc.