qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH 4/7] qapi: Fix code generation for sub-modules in other directories
Date: Fri, 1 Mar 2019 10:00:44 -0600	[thread overview]
Message-ID: <1432b833-99b1-90f1-7a0a-3dd1f8301c3b@redhat.com> (raw)
In-Reply-To: <20190301154051.23317-5-armbru@redhat.com>

On 3/1/19 9:40 AM, Markus Armbruster wrote:
> The #include directives to pull in sub-modules use file names relative
> to the main module.  Works only when all modules are in the same
> directory, or the main module's output directory is in the compiler's
> include path.  Use relative file names instead.
> 
> The dummy variable we generate to avoid empty .o files has an invalid
> name for sub-modules in other directories.  Fix that.
> 
> Both messed up in commit 252dc3105fc "qapi: Generate separate .h, .c
> for each module".  Escaped testing because tests/qapi-schema-test.json
> doesn't cover sub-modules in other directories, only
> tests/qapi-schema/include-relpath.json does, and we generate and
> compile C code only for the former, not the latter.  Fold the latter
> into the former.  This would have caught the mistakes fixed in this
> commit.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---

> +++ b/tests/.gitignore
> @@ -11,9 +11,17 @@ test-*
>  !test-*.c
>  !docker/test-*
>  test-qapi-commands.[ch]
> +include/test-qapi-commands-sub-module.[ch]
> +test-qapi-commands-sub-sub-module.[ch]
>  test-qapi-events.[ch]
> +include/test-qapi-events-sub-module.[ch]
> +test-qapi-events-sub-sub-module.[ch]
>  test-qapi-types.[ch]
> +include/test-qapi-types-sub-module.[ch]
> +test-qapi-types-sub-sub-module.[ch]
>  test-qapi-visit.[ch]
> +include/test-qapi-visit-sub-module.[ch]
> +test-qapi-visit-sub-sub-module.[ch]
>  test-qapi-introspect.[ch]
>  *-test

Messes with sorting, and makes me wonder if any globs could compress it
further, but I can live with it (as I don't have any concrete
suggestions on how better to write it).


> @@ -505,8 +504,18 @@ qapi-schema += unknown-expr-key.json
>  
>  check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
>  
> -GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
> -	tests/test-qapi-commands.h tests/test-qapi-events.h \
> +GENERATED_FILES += tests/test-qapi-types.h \
> +	tests/include/test-qapi-types-sub-module.h \
> +	tests/test-qapi-types-sub-sub-module.h \
> +	tests/test-qapi-visit.h \
> +	tests/include/test-qapi-visit-sub-module.h \
> +	tests/test-qapi-visit-sub-sub-module.h \
> +	tests/test-qapi-commands.h \
> +	tests/include/test-qapi-commands-sub-module.h \
> +	tests/test-qapi-commands-sub-sub-module.h \
> +	tests/test-qapi-events.h \
> +	tests/include/test-qapi-events-sub-module.h \
> +	tests/test-qapi-events-sub-sub-module.h \
>  	tests/test-qapi-introspect.h

Worth declaring a good portion of this list in a separate variable, then
appending that variable to GENERATED FILES as well as...


> @@ -609,12 +623,32 @@ tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
>  	$(test-block-obj-y)
>  
>  tests/test-qapi-types.c tests/test-qapi-types.h \
> +tests/include/test-qapi-types-sub-module.c \
> +tests/include/test-qapi-types-sub-module.h \
> +tests/test-qapi-types-sub-sub-module.c \
> +tests/test-qapi-types-sub-sub-module.h \
>  tests/test-qapi-visit.c tests/test-qapi-visit.h \
> +tests/include/test-qapi-visit-sub-module.c \
> +tests/include/test-qapi-visit-sub-module.h \
> +tests/test-qapi-visit-sub-sub-module.c \
> +tests/test-qapi-visit-sub-sub-module.h \
>  tests/test-qapi-commands.h tests/test-qapi-commands.c \
> +tests/include/test-qapi-commands-sub-module.h \
> +tests/include/test-qapi-commands-sub-module.c \
> +tests/test-qapi-commands-sub-sub-module.h \
> +tests/test-qapi-commands-sub-sub-module.c \
>  tests/test-qapi-events.c tests/test-qapi-events.h \
> +tests/include/test-qapi-events-sub-module.c \
> +tests/include/test-qapi-events-sub-module.h \
> +tests/test-qapi-events-sub-sub-module.c \
> +tests/test-qapi-events-sub-sub-module.h \
>  tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \

...reusing it here for less duplication?

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2019-03-01 16:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 15:40 [Qemu-devel] [PATCH 0/7] qapi: Code generation fixes Markus Armbruster
2019-03-01 15:40 ` [Qemu-devel] [PATCH 1/7] tests/qapi-schema: Make test-qapi.py print arrays Markus Armbruster
2019-03-01 15:45   ` Eric Blake
2019-03-04  8:17     ` Markus Armbruster
2019-03-01 15:40 ` [Qemu-devel] [PATCH 2/7] tests/qapi-schema: Cover conditional arrays Markus Armbruster
2019-03-01 15:46   ` Eric Blake
2019-03-01 15:40 ` [Qemu-devel] [PATCH 3/7] qapi: Pass file name to QAPIGen constructor instead of methods Markus Armbruster
2019-03-01 15:49   ` Eric Blake
2019-03-01 15:40 ` [Qemu-devel] [PATCH 4/7] qapi: Fix code generation for sub-modules in other directories Markus Armbruster
2019-03-01 16:00   ` Eric Blake [this message]
2019-03-04  8:26     ` Markus Armbruster
2019-03-01 15:40 ` [Qemu-devel] [PATCH 5/7] tests: Rename UserDefNativeListUnion to UserDefListUnion Markus Armbruster
2019-03-01 16:21   ` Eric Blake
2019-03-01 15:40 ` [Qemu-devel] [PATCH 6/7] tests/qapi-schema: Cover forward reference to sub-module Markus Armbruster
2019-03-01 16:22   ` Eric Blake
2019-03-01 15:40 ` [Qemu-devel] [PATCH 7/7] qapi: Fix array first used in a different module Markus Armbruster
2019-03-01 16:25   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432b833-99b1-90f1-7a0a-3dd1f8301c3b@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).