qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qapi: Clean up includes in generated files
@ 2016-02-08 15:36 Eric Blake
  2016-02-08 17:39 ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Blake @ 2016-02-08 15:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, armbru, Michael Roth

As a followup to commit cbf2115, clean up the includes in files
generated by QAPI so that osdep.h is included first in .c files,
and headers which it implies are not included manually.  This
patch is done manually, since Coccinelle (and therefore
scripts/clean-includes) doesn't see into the generator scripts.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 scripts/qapi-commands.py   | 1 +
 scripts/qapi-event.py      | 1 +
 scripts/qapi-introspect.py | 3 ++-
 scripts/qapi-types.py      | 3 +--
 scripts/qapi-visit.py      | 1 +
 5 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 91c5a4e..f831621 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -297,6 +297,7 @@ h_comment = '''
                             c_comment, h_comment)

 fdef.write(mcgen('''
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/module.h"
 #include "qapi/qmp/types.h"
diff --git a/scripts/qapi-event.py b/scripts/qapi-event.py
index 07bcb73..544ae12 100644
--- a/scripts/qapi-event.py
+++ b/scripts/qapi-event.py
@@ -159,6 +159,7 @@ h_comment = '''
                             c_comment, h_comment)

 fdef.write(mcgen('''
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "%(prefix)sqapi-event.h"
 #include "%(prefix)sqapi-visit.h"
diff --git a/scripts/qapi-introspect.py b/scripts/qapi-introspect.py
index 64f2cd0..e0f926b 100644
--- a/scripts/qapi-introspect.py
+++ b/scripts/qapi-introspect.py
@@ -1,7 +1,7 @@
 #
 # QAPI introspection generator
 #
-# Copyright (C) 2015 Red Hat, Inc.
+# Copyright (C) 2015-2016 Red Hat, Inc.
 #
 # Authors:
 #  Markus Armbruster <armbru@redhat.com>
@@ -204,6 +204,7 @@ h_comment = '''
                             c_comment, h_comment)

 fdef.write(mcgen('''
+#include "qemu/osdep.h"
 #include "%(prefix)sqmp-introspect.h"

 ''',
diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py
index d3f631a..7b0dca8 100644
--- a/scripts/qapi-types.py
+++ b/scripts/qapi-types.py
@@ -279,6 +279,7 @@ h_comment = '''
                             c_comment, h_comment)

 fdef.write(mcgen('''
+#include "qemu/osdep.h"
 #include "qapi/dealloc-visitor.h"
 #include "%(prefix)sqapi-types.h"
 #include "%(prefix)sqapi-visit.h"
@@ -287,8 +288,6 @@ fdef.write(mcgen('''

 # To avoid circular headers, use only typedefs.h here, not qobject.h
 fdecl.write(mcgen('''
-#include <stdbool.h>
-#include <stdint.h>
 #include "qemu/typedefs.h"
 '''))

diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index 0fdcebc..0cc9b08 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -435,6 +435,7 @@ h_comment = '''
                             c_comment, h_comment)

 fdef.write(mcgen('''
+#include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "%(prefix)sqapi-visit.h"
 ''',
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH] qapi: Clean up includes in generated files
  2016-02-08 15:36 [Qemu-devel] [PATCH] qapi: Clean up includes in generated files Eric Blake
@ 2016-02-08 17:39 ` Markus Armbruster
  2016-02-08 17:45   ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2016-02-08 17:39 UTC (permalink / raw)
  To: Eric Blake; +Cc: peter.maydell, qemu-devel, Michael Roth

Eric Blake <eblake@redhat.com> writes:

> As a followup to commit cbf2115, clean up the includes in files
> generated by QAPI so that osdep.h is included first in .c files,
> and headers which it implies are not included manually.  This
> patch is done manually, since Coccinelle (and therefore
> scripts/clean-includes) doesn't see into the generator scripts.
>
> Signed-off-by: Eric Blake <eblake@redhat.com>

  CC    tests/check-qfloat.o
In file included from /home/armbru/work/qemu/include/qapi/qmp/qobject.h:37:0,
                 from /home/armbru/work/qemu/include/qapi/qmp/qfloat.h:18,
                 from /home/armbru/work/qemu/tests/check-qfloat.c:15:
./qapi-types.h:55:9: error: unknown type name ‘bool’
         bool value;
         ^

Chicken and egg problem?  check-qfloat.c doesn't include osdep.h, yet...

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

* Re: [Qemu-devel] [PATCH] qapi: Clean up includes in generated files
  2016-02-08 17:39 ` Markus Armbruster
@ 2016-02-08 17:45   ` Peter Maydell
  2016-02-08 18:25     ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Maydell @ 2016-02-08 17:45 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU Developers, Michael Roth

On 8 February 2016 at 17:39, Markus Armbruster <armbru@redhat.com> wrote:
> Eric Blake <eblake@redhat.com> writes:
>
>> As a followup to commit cbf2115, clean up the includes in files
>> generated by QAPI so that osdep.h is included first in .c files,
>> and headers which it implies are not included manually.  This
>> patch is done manually, since Coccinelle (and therefore
>> scripts/clean-includes) doesn't see into the generator scripts.
>>
>> Signed-off-by: Eric Blake <eblake@redhat.com>
>
>   CC    tests/check-qfloat.o
> In file included from /home/armbru/work/qemu/include/qapi/qmp/qobject.h:37:0,
>                  from /home/armbru/work/qemu/include/qapi/qmp/qfloat.h:18,
>                  from /home/armbru/work/qemu/tests/check-qfloat.c:15:
> ./qapi-types.h:55:9: error: unknown type name ‘bool’
>          bool value;
>          ^
>
> Chicken and egg problem?  check-qfloat.c doesn't include osdep.h, yet...

Easy enough to add it; I have 'run clean-includes on tests/' on
my todo list, but it requires a little care because I think at
least some .c files in tests/ do not have QEMU headers in their
include path at all. This might just be tests/tcg/.

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] qapi: Clean up includes in generated files
  2016-02-08 17:45   ` Peter Maydell
@ 2016-02-08 18:25     ` Markus Armbruster
  2016-02-08 18:29       ` Peter Maydell
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2016-02-08 18:25 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Michael Roth

Peter Maydell <peter.maydell@linaro.org> writes:

> On 8 February 2016 at 17:39, Markus Armbruster <armbru@redhat.com> wrote:
>> Eric Blake <eblake@redhat.com> writes:
>>
>>> As a followup to commit cbf2115, clean up the includes in files
>>> generated by QAPI so that osdep.h is included first in .c files,
>>> and headers which it implies are not included manually.  This
>>> patch is done manually, since Coccinelle (and therefore
>>> scripts/clean-includes) doesn't see into the generator scripts.
>>>
>>> Signed-off-by: Eric Blake <eblake@redhat.com>
>>
>>   CC    tests/check-qfloat.o
>> In file included from /home/armbru/work/qemu/include/qapi/qmp/qobject.h:37:0,
>>                  from /home/armbru/work/qemu/include/qapi/qmp/qfloat.h:18,
>>                  from /home/armbru/work/qemu/tests/check-qfloat.c:15:
>> ./qapi-types.h:55:9: error: unknown type name ‘bool’
>>          bool value;
>>          ^
>>
>> Chicken and egg problem?  check-qfloat.c doesn't include osdep.h, yet...
>
> Easy enough to add it; I have 'run clean-includes on tests/' on
> my todo list, but it requires a little care because I think at
> least some .c files in tests/ do not have QEMU headers in their
> include path at all. This might just be tests/tcg/.

With "make check" fixed:
Reviewed-by: Markus Armbruster <armbru@redhat.com>

I'm happy to take it through my tree when it's ready (tell me then), but
it might be easier to take it along whatever fixes "make check".

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

* Re: [Qemu-devel] [PATCH] qapi: Clean up includes in generated files
  2016-02-08 18:25     ` Markus Armbruster
@ 2016-02-08 18:29       ` Peter Maydell
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2016-02-08 18:29 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: QEMU Developers, Michael Roth

On 8 February 2016 at 18:25, Markus Armbruster <armbru@redhat.com> wrote:
> With "make check" fixed:
> Reviewed-by: Markus Armbruster <armbru@redhat.com>
>
> I'm happy to take it through my tree when it's ready (tell me then), but
> it might be easier to take it along whatever fixes "make check".

OK; I'm currently doing the testing bit for the 'fix includes
in tests' part. Probably I'll apply that directly to master once it's
had a little review time on list.

thanks
-- PMM

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

end of thread, other threads:[~2016-02-08 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-08 15:36 [Qemu-devel] [PATCH] qapi: Clean up includes in generated files Eric Blake
2016-02-08 17:39 ` Markus Armbruster
2016-02-08 17:45   ` Peter Maydell
2016-02-08 18:25     ` Markus Armbruster
2016-02-08 18:29       ` 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).