[Spice-devel] [PATCH spice-common 5/9] Allow to generate C declarations for spice.proto
Frediano Ziglio
fziglio at redhat.com
Fri Mar 8 21:51:20 UTC 2019
>
> On Sun, Mar 03, 2019 at 07:10:26PM +0000, Frediano Ziglio wrote:
> > Generate and include C declarations.
> > Next patch will use this facility.
>
> Since none of the spice.proto types are decorated with @declare, adding
> the #include in messages.h won't have any bad consequences
>
Are you suggesting to add a comment or to remove the last hunk?
> >
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> > common/Makefile.am | 6 ++++--
> > common/meson.build | 10 +++++++++-
> > common/messages.h | 2 ++
> > 3 files changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/common/Makefile.am b/common/Makefile.am
> > index 3da5bad..411831b 100644
> > --- a/common/Makefile.am
> > +++ b/common/Makefile.am
> > @@ -109,8 +109,9 @@ MARSHALLERS_DEPS = \
> >
> > # Note despite being autogenerated these are not part of CLEANFILES, they
> > are
> > # actually a part of EXTRA_DIST, to avoid the need for pyparser by end
> > users
> > -generated_client_demarshallers.c: $(top_srcdir)/spice.proto
> > $(MARSHALLERS_DEPS)
> > - $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> > --generate-demarshallers --client --include common/messages.h $< $@
> > >/dev/null
> > +generated_client_demarshallers.c generated_messages.h:
> > $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
> > + $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> > --generate-demarshallers --client --include common/messages.h \
> > + --generated-declaration-file generated_messages.h $< $@ >/dev/null
> >
> > generated_client_marshallers.c generated_client_marshallers.h:
> > $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
> > $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> > --generate-marshallers -P --include client_marshallers.h --client \
> > @@ -135,6 +136,7 @@ EXTRA_DIST = \
> > quic_family_tmpl.c \
> > quic_tmpl.c \
> > snd_codec.h \
> > + generated_messages.h \
>
> Unrelated to this patch, but I wonder why snd_codec.h is listed there.
> I'd put generated_messages.h close to the $(CLIENT_MARSHALLERS) and
> $(SERVER_MARSHALLERS) variables.
>
Maybe adding to both CLIENT_MARSHALLERS and SERVER_MARSHALLERS ?
> Reviewed-by: Christophe Fergeau <cfergeau at redhat.com>
>
> > $(NULL)
> >
> > -include $(top_srcdir)/git.mk
> > diff --git a/common/meson.build b/common/meson.build
> > index 9575568..2d769f2 100644
> > --- a/common/meson.build
> > +++ b/common/meson.build
> > @@ -64,7 +64,15 @@ spice_common_dep = declare_dependency(link_with :
> > spice_common_lib,
> > #
> > if spice_common_generate_client_code
> > targets = [
> > - ['client_demarshallers', spice_proto,
> > 'generated_client_demarshallers.c', ['--generate-demarshallers',
> > '--client', '--include', 'common/messages.h', '@INPUT@', '@OUTPUT@']],
> > + ['client_demarshallers', spice_proto,
> > + ['generated_client_demarshallers.c', 'generated_messages.h'],
> > + ['--generate-demarshallers',
> > + '--client',
> > + '--include', 'common/messages.h',
> > + '--generated-declaration-file', '@OUTPUT1@',
> > + '@INPUT@', '@OUTPUT0@'
> > + ]
> > + ],
> > ['client_marshallers', spice_proto,
> > ['generated_client_marshallers.c',
> > 'generated_client_marshallers.h'],
> > ['--generate-marshallers',
> > diff --git a/common/messages.h b/common/messages.h
> > index f740a8c..36ee59d 100644
> > --- a/common/messages.h
> > +++ b/common/messages.h
> > @@ -558,6 +558,8 @@ typedef struct SpiceMsgDisplayGlDraw {
> > uint32_t h;
> > } SpiceMsgDisplayGlDraw;
> >
> > +#include <common/generated_messages.h>
> > +
> > SPICE_END_DECLS
> >
> > #endif // H_SPICE_COMMON_MESSAGES
Frediano
More information about the Spice-devel
mailing list