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 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?

I decided to use <> specification and quote using " by default as
this is easier if a shell is involved (which happens using Makefiles).

Frediano
_______________________________________________
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]