[Xcb] [PUSHED] [PATCH proto 1/2] optionally enforce serialization of pads

Christian Linhart chris at DemoRecorder.com
Sun Jan 31 23:03:48 PST 2016


Hi,

I've just pushed this series.
I posted this about two weeks ago, and there was neither complaint nor review.
Therefore pushed due to review-by-crickets.

I you find bugs in there later, please post a patch to fix these bugs.

Chris


On 2016-01-18 06:52, Christian Linhart wrote:
> From now on, due to a patch in libxcb, pads will not be serialized
> anymore. This is to maintain ABI-compatibility when adding
> explicit align pads.
>
> However, some align pads were already be serialized in prior
> official versions of libxcb. Therefore we need a method to
> enforce serialization, so we can maintainn ABI compatibility
> with that legacy.
>
> Signed-off-by: Christian Linhart <chris at demorecorder.com>
> ---
>  doc/xml-xcb.txt  | 9 ++++++++-
>  xcbgen/xtypes.py | 2 ++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/doc/xml-xcb.txt b/doc/xml-xcb.txt
> index 12c0881..9cef1de 100644
> --- a/doc/xml-xcb.txt
> +++ b/doc/xml-xcb.txt
> @@ -187,19 +187,26 @@ than type="PIXMAP".
>  Note: Most of the below may optionally contain an enum, altenum, mask or altmask
>  attribute, which follows the above rules for "type". "enum" is an exhaustive
>  enum; the value is restricted to one of the constants named in the enum.
>  "altenum" may be one of the values contained in the enum, but it need not be.
>  "mask" refers to an exhaustive enum to be used as a bitmask.
>  "altmask" may be a mask from the referred enum, but it need not be.
>  
> -<pad bytes="integer" />
> +<pad bytes="integer" serialize="bool" />
>  
>    This element declares some padding in a data structure.  The bytes
>    attribute declares the number of bytes of padding.
>  
> +  If serialize="true", then the pad will be serialized/deserialized.
> +  This is only needed for ABI compatibility with legacy.
> +  Newly added pads should not be defined with serialize="true".
> +
> +  The serialize attribute may be omitted.
> +  Default is serialize="false".
> +
>  <field type="identifier" name="identifier" />
>  
>    This element represents a field in a data structure.  The type attribute
>    declares the data type of the field, and the name attribute gives the name
>    of the field.
>  
>  <fd name="identifier" />
> diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
> index 1f604de..c3b5758 100644
> --- a/xcbgen/xtypes.py
> +++ b/xcbgen/xtypes.py
> @@ -2,14 +2,15 @@
>  This module contains the classes which represent XCB data types.
>  '''
>  from xcbgen.expr import Field, Expression
>  from xcbgen.align import Alignment, AlignmentLog
>  import __main__
>  
>  verbose_align_log = False
> +true_values = ['true', '1', 'yes']
>  
>  class Type(object):
>      '''
>      Abstract base class for all XCB data types.
>      Contains default fields, and some abstract methods.
>      '''
>      def __init__(self, name):
> @@ -425,14 +426,15 @@ class PadType(Type):
>          self.is_pad = True
>          self.size = 1
>          self.nmemb = 1
>          self.align = 1
>          if elt != None:
>              self.nmemb = int(elt.get('bytes', "1"), 0)
>              self.align = int(elt.get('align', "1"), 0)
> +            self.serialize = elt.get('serialize', "false").lower() in true_values
>  
>          # pads don't require any alignment at their start
>          self.required_start_align = Alignment(1,0)
>  
>      def resolve(self, module):
>          self.resolved = True
>  



More information about the Xcb mailing list