Re: [spice-common 3/3] codegen: Autogenerate client_marshallers.h

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

 



> 
> On Tue, Jun 21, 2016 at 07:22:34AM -0400, Frediano Ziglio wrote:
> > > On Tue, Jun 21, 2016 at 05:15:54AM -0400, Frediano Ziglio wrote:
> > > > About the macro, what about
> > > > 
> > > > 
> > > > diff --git a/python_modules/marshal.py b/python_modules/marshal.py
> > > > index cd4b4fa..c2235e2 100644
> > > > --- a/python_modules/marshal.py
> > > > +++ b/python_modules/marshal.py
> > > > @@ -1,13 +1,20 @@
> > > >  
> > > >  from . import ptypes
> > > >  from . import codegen
> > > > +import re
> > > >  
> > > >  def write_includes(writer):
> > > >      writer.header.writeln("#include <spice/protocol.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")
> > > > +    if writer.header.has_option("dest_file"):
> > > > +        src = writer.header.options["dest_file"]
> > > > +    else:
> > > > +        src = "generated_headers.h"
> > > > +    src = re.sub(r'[^a-z0-9]+', '_', 'file_' + src,
> > > > flags=re.IGNORECASE)
> > > > +    src = src.upper()
> > > > +    writer.header.writeln("#ifndef %s" % src)
> > > > +    writer.header.writeln("#define %s" % src)
> > > 
> > > Looks good to me, I'd probably squash this in:
> > > 
> > > --- a/python_modules/marshal.py
> > > +++ b/python_modules/marshal.py
> > > @@ -11,8 +11,10 @@ def write_includes(writer):
> > >          src = writer.header.options["dest_file"]
> > >      else:
> > >          src = "generated_headers.h"
> > > -    src = re.sub(r'[^a-z0-9]+', '_', 'file_' + src, flags=re.IGNORECASE)
> > > +    src = re.sub(r'[^a-z0-9]+', '_', src, flags=re.IGNORECASE)
> > >      src = src.upper()
> > > +    if src.endswith("_H"):
> > > +        src = "_H_"+src[:-2]
> > 
> > This is not C99 compatible
> 
> I knew you would answer that, but this is the form which is used in most
> spice-common headers (and in gnulib too apparently), so I'd just assume
> this is not going to be an issue.
> 
> Christophe
> 

Yes, usually it's not an issue, until standard/system libraries use these
identifiers, in this case you'll have to rename.

Can you post the final patch?

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]