Re: [spice-common 3/5] codegen: Use "" rather than <> for cmdline includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 24, 2016 at 03:02:34AM -0400, Frediano Ziglio wrote:
> > 
> > On Thu, Jun 23, 2016 at 02:03:45PM +0200, Pavel Grunt wrote:
> > > Hi Christophe,
> > > 
> > > they were patches changing spice common includes to use <> instead of "",
> > > so I
> > > would keep it.
> > 
> > The generated code is in spice-common/common, so my understanding is
> > that "" should be used there for headers from the spice-common module
> > (see spice-common/common/region.c for example). Headers from other
> > modules (spice-protocol) should use <>.
> > In this case, it's changing #include <common/...> to #include
> > "common/..." (but it would do the wrong thing if we started passing
> > spice-protocol headers on the command line)
> > 
> > Christophe
> > 
> 
> Given that:
> - all .c files in spice-common are in common directory;
> - spice-common is intended to be used only by spice-server and spice-gtk;
> - spice-server and spice-gtk has no common subdirectory;
> the local path is never used for "common/.." include file, that is
> path for local "common/foo.h" is "common/common/foo.h" which will never
> exist. Compiler find the include using the fallback "system" include way
> (same used for <> include).
> However there should be cases where a local include is more suitable
> that is .c files or headers never included by users of spice-common.
> To have more control I could suggest something like
> 
>  if options.includes:
>      for i in options.includes:
>          if i[:1] != '<':
>              i = '"%s"' % i
>          writer.header.writeln('#include %s' % i)
>          writer.writeln('#include %s' % i)
> 
> so caller of the script can choose the version of include to use.
> 
> What about for instance if we want to include a system header?

Given that it's not currently the case, the code generation code is not
moving that much, I would not bother making it more complex. Using ""
instead of <> avoids one inconsistency you mentioned earlier (generated
code using both <common/..> and "common/..."). If we need to add a
system header, it's very likely we'll be able to hardcode it in the
python code rather than as a command line argument. In short, I'd keep
things simple.

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]