[Spice-devel] [PATCH 2/2] Use #include "common/..." in (de)marshallers

Marc-André Lureau marcandre.lureau at gmail.com
Wed Mar 19 09:25:48 PDT 2014


aren't the #include "header" looked up in current file directory?


On Wed, Mar 19, 2014 at 4:30 PM, Christophe Fergeau <cfergeau at redhat.com>wrote:

> Now that they are created in $builddir, their includes will need to refer
> to files in $srcdir, which can be different. It's cleaner to add
> -I $(top_srcdir)/spice-common/ to modules using spice-common rather than
> having -I $(top_srcdir)/spice-common/common which would could create header
> collisions.
> ---
>  common/Makefile.am          | 15 ++++++++-------
>  python_modules/demarshal.py |  2 +-
>  python_modules/marshal.py   |  4 ++--
>  3 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/common/Makefile.am b/common/Makefile.am
> index f985057..435d448 100644
> --- a/common/Makefile.am
> +++ b/common/Makefile.am
> @@ -81,6 +81,7 @@ libspice_common_la_SOURCES +=         \
>  endif
>
>  AM_CPPFLAGS =                          \
> +       -I$(top_srcdir)                 \
>         $(GL_CFLAGS)                    \
>         $(PIXMAN_CFLAGS)                \
>         $(CELT051_CFLAGS)               \
> @@ -109,26 +110,26 @@ 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 messages.h $< $@ >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-demarshallers --client --include common/messages.h $< $@
> >/dev/null
>
>  generated_client_demarshallers1.c: $(top_srcdir)/spice1.proto
> $(MARSHALLERS_DEPS)
> -       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize
> 8 $< $@ >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-demarshallers --client --include common/messages.h --prefix 1
> --ptrsize 8 $< $@ >/dev/null
>
>  generated_client_marshallers.c: $(top_srcdir)/spice.proto
> $(MARSHALLERS_DEPS)
> -       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers -P --include messages.h --include
> client_marshallers.h --client $< $@ >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers -P --include common/messages.h --include
> client_marshallers.h --client $< $@ >/dev/null
>
>  generated_client_marshallers1.c: $(top_srcdir)/spice1.proto
> $(MARSHALLERS_DEPS)
> -       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers -P --include messages.h --include
> client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers -P --include common/messages.h --include
> client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null
>
>  generated_server_demarshallers.c: $(top_srcdir)/spice.proto
> $(MARSHALLERS_DEPS)
> -       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-demarshallers --server --include messages.h $< $@ >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-demarshallers --server --include common/messages.h $< $@
> >/dev/null
>
>  STRUCTS = -M String -M Rect -M Point -M DisplayBase -M Fill -M Opaque -M
> Copy -M Blend -M Blackness -M Whiteness -M Invers -M Rop3 -M Stroke -M Text
> -M Transparent -M AlphaBlend -M Composite
>  generated_server_marshallers.c: $(top_srcdir)/spice.proto
> $(MARSHALLERS_DEPS)
> -       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers $(STRUCTS) --server --include messages.h $< $@
> >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers $(STRUCTS) --server --include common/messages.h $<
> $@ >/dev/null
>
>  generated_server_marshallers.h: $(top_srcdir)/spice.proto
> $(MARSHALLERS_DEPS)
> -       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers $(STRUCTS) --server --include messages.h -H $< $@
> >/dev/null
> +       $(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py
> --generate-marshallers $(STRUCTS) --server --include common/messages.h -H
> $< $@ >/dev/null
>
>  # this is going to upset automake distcheck, since we try to write to
>  # readonly srcdir. To limit the fail chances, rebuild automatically
> diff --git a/python_modules/demarshal.py b/python_modules/demarshal.py
> index cf48d74..794cd25 100644
> --- a/python_modules/demarshal.py
> +++ b/python_modules/demarshal.py
> @@ -1250,7 +1250,7 @@ def write_includes(writer):
>      writer.writeln("#include <stdio.h>")
>      writer.writeln("#include <spice/protocol.h>")
>      writer.writeln("#include <spice/macros.h>")
> -    writer.writeln('#include "mem.h"')
> +    writer.writeln('#include "common/mem.h"')
>      writer.newline()
>      writer.writeln("#ifdef _MSC_VER")
>      writer.writeln("#pragma warning(disable:4101)")
> diff --git a/python_modules/marshal.py b/python_modules/marshal.py
> index 4020799..ae5fe31 100644
> --- a/python_modules/marshal.py
> +++ b/python_modules/marshal.py
> @@ -4,7 +4,7 @@ import codegen
>
>  def write_includes(writer):
>      writer.header.writeln("#include <spice/protocol.h>")
> -    writer.header.writeln('#include "marshaller.h"')
> +    writer.header.writeln('#include "common/marshaller.h"')
>      writer.header.newline()
>      writer.header.writeln("#ifndef _GENERATED_HEADERS_H")
>      writer.header.writeln("#define _GENERATED_HEADERS_H")
> @@ -15,7 +15,7 @@ def write_includes(writer):
>      writer.writeln("#include <stdio.h>")
>      writer.writeln("#include <spice/protocol.h>")
>      writer.writeln("#include <spice/macros.h>")
> -    writer.writeln('#include "marshaller.h"')
> +    writer.writeln('#include "common/marshaller.h"')
>      writer.newline()
>      writer.writeln("#ifdef _MSC_VER")
>      writer.writeln("#pragma warning(disable:4101)")
> --
> 1.8.5.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20140319/190c795d/attachment.html>


More information about the Spice-devel mailing list