Re: [PATCH v6 01/42] Supports ifdef attribute on enumerations

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

 



Hey,

Ah, this adds some #ifdef to the enums.h file. I was hoping we could
totally omit them from the output of the generator ;) Should do, but
then the @ifdef should be SPICE_DISSECTOR, not a non-namespaced
DISSECTOR.

Christophe

On Thu, Aug 13, 2015 at 02:11:40PM +0100, Frediano Ziglio wrote:
> This allows to exclude some enumaration for different
> purposes.
> For instance one could use some enumerations only on
> marshaller to avoid clash with some other demarshaller
> defines.
> 
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  python_modules/ptypes.py | 2 --
>  spice_codegen.py         | 6 ++++++
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
> index 7ab2771..c1eb756 100644
> --- a/python_modules/ptypes.py
> +++ b/python_modules/ptypes.py
> @@ -390,7 +390,6 @@ class EnumType(EnumBaseType):
>          writer.write(self.c_name())
>          writer.write(";")
>          writer.newline()
> -        writer.newline()
>  
>  class FlagsType(EnumBaseType):
>      def __init__(self, bits, name, flags, attribute_list):
> @@ -444,7 +443,6 @@ class FlagsType(EnumBaseType):
>          writer.write(self.c_name())
>          writer.write(";")
>          writer.newline()
> -        writer.newline()
>  
>  class ArrayType(Type):
>      def __init__(self, element_type, size):
> diff --git a/spice_codegen.py b/spice_codegen.py
> index 569cccc..2f3dbff 100755
> --- a/spice_codegen.py
> +++ b/spice_codegen.py
> @@ -85,9 +85,15 @@ def write_enums(writer, describe=False):
>      # Define enums
>      for t in ptypes.get_named_types():
>          if isinstance(t, ptypes.EnumBaseType):
> +            if t.has_attr("ifdef"):
> +                writer.ifdef(t.attributes["ifdef"][0])
>              t.c_define(writer)
>              if describe:
> +                writer.newline()
>                  t.c_describe(writer)
> +            if t.has_attr("ifdef"):
> +                writer.endif(t.attributes["ifdef"][0])
> +            writer.newline()
>  
>      write_channel_type_enum(writer)
>      if (describe):
> -- 
> 2.4.3
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgp8YDnSZZjSp.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://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]