[Xcb] [PATCH libxcb 2/2 v2] c_client.py: don't generate useless empty /** < */ comments

Christian Linhart chris at DemoRecorder.com
Sat May 30 03:15:27 PDT 2015


Hi Ran,

Thank you for the updated patch and sorry for my delayed review.

This just removes comments in the output.
So, the code does the same.

Therefore:
Reviewed-by: Christian Linhart <chris at demorecorder.com>

I will push this patch right now because there was more than enough time for other reviews.

BTW, there are still some places where this kind of comments are generated.
We may want to remove all of them...


On 03/18/15 11:27, Ran Benita wrote:
> (This does not change doxygen's output or warnings).
>
> Signed-off-by: Ran Benita <ran234 at gmail.com>
> ---
> v2: rebased.
>
>  src/c_client.py | 84 ++++++++++++++++++++++++++++-----------------------------
>  1 file changed, 42 insertions(+), 42 deletions(-)
>
> diff --git a/src/c_client.py b/src/c_client.py
> index 2cf7937..f075fd0 100644
> --- a/src/c_client.py
> +++ b/src/c_client.py
> @@ -1326,7 +1326,7 @@ def _c_serialize(context, self):
>      for p in params:
>          typespec, pointerspec, field_name = p
>          spacing = ' '*(maxtypelen-len(typespec)-len(pointerspec))
> -        param_str.append("%s%s%s  %s%s  /**< */" % (indent, typespec, spacing, pointerspec, field_name))
> +        param_str.append("%s%s%s  %s%s" % (indent, typespec, spacing, pointerspec, field_name))
>      # insert function name
>      param_str[0] = "%s (%s" % (func_name, param_str[0].strip())
>      param_str = ["%s," % x for x in param_str]
> @@ -1519,9 +1519,9 @@ def _c_iterator(self, name):
>      _h(' * @brief %s', self.c_iterator_type)
>      _h(' **/')
>      _h('typedef struct %s {', self.c_iterator_type)
> -    _h('    %s *data; /**<  */', self.c_type)
> -    _h('    int%s rem; /**<  */', ' ' * (len(self.c_type) - 2))
> -    _h('    int%s index; /**<  */', ' ' * (len(self.c_type) - 2))
> +    _h('    %s *data;', self.c_type)
> +    _h('    int%s rem;', ' ' * (len(self.c_type) - 2))
> +    _h('    int%s index;', ' ' * (len(self.c_type) - 2))
>      # add additional params of the type "self" as fields to the iterator struct
>      # so that they can be passed to the sizeof-function by the iterator's next-function
>      params = _c_get_additional_type_params(self)
> @@ -1545,8 +1545,8 @@ def _c_iterator(self, name):
>      _h(' */')
>      _c('')
>      _hc('void')
> -    _h('%s (%s *i  /**< */);', self.c_next_name, self.c_iterator_type)
> -    _c('%s (%s *i  /**< */)', self.c_next_name, self.c_iterator_type)
> +    _h('%s (%s *i);', self.c_next_name, self.c_iterator_type)
> +    _c('%s (%s *i)', self.c_next_name, self.c_iterator_type)
>      _c('{')
>  
>      if not self.fixed_size():
> @@ -1591,8 +1591,8 @@ def _c_iterator(self, name):
>      _h(' */')
>      _c('')
>      _hc('xcb_generic_iterator_t')
> -    _h('%s (%s i  /**< */);', self.c_end_name, self.c_iterator_type)
> -    _c('%s (%s i  /**< */)', self.c_end_name, self.c_iterator_type)
> +    _h('%s (%s i);', self.c_end_name, self.c_iterator_type)
> +    _c('%s (%s i)', self.c_end_name, self.c_iterator_type)
>      _c('{')
>      _c('    xcb_generic_iterator_t ret;')
>  
> @@ -1748,8 +1748,8 @@ def _c_accessors_field(self, field):
>      if field.type.is_simple:
>          _hc('')
>          _hc('%s', field.c_field_type)
> -        _h('%s (const %s *R  /**< */);', field.c_accessor_name, c_type)
> -        _c('%s (const %s *R  /**< */)', field.c_accessor_name, c_type)
> +        _h('%s (const %s *R);', field.c_accessor_name, c_type)
> +        _c('%s (const %s *R)', field.c_accessor_name, c_type)
>          _c('{')
>          if field.prev_varsized_field is None:
>              _c('    return (%s *) (R + 1);', field.c_field_type)
> @@ -1766,8 +1766,8 @@ def _c_accessors_field(self, field):
>              return_type = '%s *' % field.c_field_type
>  
>          _hc(return_type)
> -        _h('%s (const %s *R  /**< */);', field.c_accessor_name, c_type)
> -        _c('%s (const %s *R  /**< */)', field.c_accessor_name, c_type)
> +        _h('%s (const %s *R);', field.c_accessor_name, c_type)
> +        _c('%s (const %s *R)', field.c_accessor_name, c_type)
>          _c('{')
>          if field.prev_varsized_field is None:
>              _c('    return (%s) (R + 1);', return_type)
> @@ -1866,7 +1866,7 @@ def _c_accessors_list(self, field):
>          if len(additional_params) == 0:
>              return ''
>          else:
> -            return (',\n' + indent).join([''] + ['%s %s /**< */' % p for p in additional_params])
> +            return (',\n' + indent).join([''] + ['%s %s' % p for p in additional_params])
>  
>      _h_setlevel(1)
>      _c_setlevel(1)
> @@ -1875,8 +1875,8 @@ def _c_accessors_list(self, field):
>          _hc('')
>          _hc('%s *', field.c_field_type)
>  
> -        _h('%s (%s  /**< */);', field.c_accessor_name, params[idx][0])
> -        _c('%s (%s  /**< */)', field.c_accessor_name, params[idx][0])
> +        _h('%s (%s);', field.c_accessor_name, params[idx][0])
> +        _c('%s (%s)', field.c_accessor_name, params[idx][0])
>  
>          _c('{')
>          if switch_obj is not None:
> @@ -1901,12 +1901,12 @@ def _c_accessors_list(self, field):
>      spacing = ' '*(len(field.c_length_name)+2)
>      add_param_str = additional_params_to_str(spacing)
>      if switch_obj is not None:
> -        _hc('%s (const %s *R  /**< */,', field.c_length_name, R_obj.c_type)
> -        _h('%sconst %s *S /**< */%s);', spacing, S_obj.c_type, add_param_str)
> -        _c('%sconst %s *S  /**< */%s)', spacing, S_obj.c_type, add_param_str)
> +        _hc('%s (const %s *R,', field.c_length_name, R_obj.c_type)
> +        _h('%sconst %s *S%s);', spacing, S_obj.c_type, add_param_str)
> +        _c('%sconst %s *S%s)', spacing, S_obj.c_type, add_param_str)
>      else:
> -        _h('%s (const %s *R  /**< */%s);', field.c_length_name, c_type, add_param_str)
> -        _c('%s (const %s *R  /**< */%s)', field.c_length_name, c_type, add_param_str)
> +        _h('%s (const %s *R%s);', field.c_length_name, c_type, add_param_str)
> +        _c('%s (const %s *R%s)', field.c_length_name, c_type, add_param_str)
>      _c('{')
>      length = _c_accessor_get_expr(field.type.expr, fields)
>      _c('    return %s;', length)
> @@ -1918,12 +1918,12 @@ def _c_accessors_list(self, field):
>          spacing = ' '*(len(field.c_end_name)+2)
>          add_param_str = additional_params_to_str(spacing)
>          if switch_obj is not None:
> -            _hc('%s (const %s *R  /**< */,', field.c_end_name, R_obj.c_type)
> -            _h('%sconst %s *S /**< */%s);', spacing, S_obj.c_type, add_param_str)
> -            _c('%sconst %s *S  /**< */%s)', spacing, S_obj.c_type, add_param_str)
> +            _hc('%s (const %s *R,', field.c_end_name, R_obj.c_type)
> +            _h('%sconst %s *S%s);', spacing, S_obj.c_type, add_param_str)
> +            _c('%sconst %s *S%s)', spacing, S_obj.c_type, add_param_str)
>          else:
> -            _h('%s (const %s *R  /**< */%s);', field.c_end_name, c_type, add_param_str)
> -            _c('%s (const %s *R  /**< */%s)', field.c_end_name, c_type, add_param_str)
> +            _h('%s (const %s *R%s);', field.c_end_name, c_type, add_param_str)
> +            _c('%s (const %s *R%s)', field.c_end_name, c_type, add_param_str)
>          _c('{')
>          _c('    xcb_generic_iterator_t i;')
>  
> @@ -1951,12 +1951,12 @@ def _c_accessors_list(self, field):
>          spacing = ' '*(len(field.c_iterator_name)+2)
>          add_param_str = additional_params_to_str(spacing)
>          if switch_obj is not None:
> -            _hc('%s (const %s *R  /**< */,', field.c_iterator_name, R_obj.c_type)
> -            _h('%sconst %s *S /**< */%s);', spacing, S_obj.c_type, add_param_str)
> -            _c('%sconst %s *S  /**< */%s)', spacing, S_obj.c_type, add_param_str)
> +            _hc('%s (const %s *R,', field.c_iterator_name, R_obj.c_type)
> +            _h('%sconst %s *S%s);', spacing, S_obj.c_type, add_param_str)
> +            _c('%sconst %s *S%s)', spacing, S_obj.c_type, add_param_str)
>          else:
> -            _h('%s (const %s *R  /**< */%s);', field.c_iterator_name, c_type, add_param_str)
> -            _c('%s (const %s *R  /**< */%s)', field.c_iterator_name, c_type, add_param_str)
> +            _h('%s (const %s *R%s);', field.c_iterator_name, c_type, add_param_str)
> +            _c('%s (const %s *R%s)', field.c_iterator_name, c_type, add_param_str)
>          _c('{')
>          _c('    %s i;', field.c_iterator_type)
>  
> @@ -2062,10 +2062,10 @@ def _c_complex(self, force_packed = False):
>              # necessary for unserialize to work
>              (self.is_switch and field.type.is_switch)):
>              spacing = ' ' * (maxtypelen - len(field.c_field_type))
> -            _h('%s    %s%s %s%s; /**<  */', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
> +            _h('%s    %s%s %s%s;', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
>          else:
>              spacing = ' ' * (maxtypelen - (len(field.c_field_type) + 1))
> -            _h('%s    %s%s *%s%s; /**<  */', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
> +            _h('%s    %s%s *%s%s;', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
>  
>      if not self.is_switch:
>          for field in struct_fields:
> @@ -2242,9 +2242,9 @@ def _c_request_helper(self, name, void, regular, aux=False, reply_fds=False):
>  
>      spacing = ' ' * (maxtypelen - len('xcb_connection_t'))
>      comma = ',' if len(param_fields) else ');'
> -    _h('%s (xcb_connection_t%s *c  /**< */%s', func_name, spacing, comma)
> +    _h('%s (xcb_connection_t%s *c%s', func_name, spacing, comma)
>      comma = ',' if len(param_fields) else ')'
> -    _c('%s (xcb_connection_t%s *c  /**< */%s', func_name, spacing, comma)
> +    _c('%s (xcb_connection_t%s *c%s', func_name, spacing, comma)
>  
>      func_spacing = ' ' * (len(func_name) + 2)
>      count = len(param_fields)
> @@ -2257,10 +2257,10 @@ def _c_request_helper(self, name, void, regular, aux=False, reply_fds=False):
>              c_pointer = '*'
>          spacing = ' ' * (maxtypelen - len(c_field_const_type))
>          comma = ',' if count else ');'
> -        _h('%s%s%s %s%s  /**< */%s', func_spacing, c_field_const_type,
> +        _h('%s%s%s %s%s%s', func_spacing, c_field_const_type,
>             spacing, c_pointer, field.c_field_name, comma)
>          comma = ',' if count else ')'
> -        _c('%s%s%s %s%s  /**< */%s', func_spacing, c_field_const_type,
> +        _c('%s%s%s %s%s%s', func_spacing, c_field_const_type,
>             spacing, c_pointer, field.c_field_name, comma)
>  
>      count = 2
> @@ -2456,10 +2456,10 @@ def _c_reply(self, name):
>      _h(' */')
>      _c('')
>      _hc('%s *', self.c_reply_type)
> -    _hc('%s (xcb_connection_t%s  *c  /**< */,', self.c_reply_name, spacing1)
> +    _hc('%s (xcb_connection_t%s  *c,', self.c_reply_name, spacing1)
>      _hc('%s%s   cookie  /**< */,', spacing3, self.c_cookie_type)
> -    _h('%sxcb_generic_error_t%s **e  /**< */);', spacing3, spacing2)
> -    _c('%sxcb_generic_error_t%s **e  /**< */)', spacing3, spacing2)
> +    _h('%sxcb_generic_error_t%s **e);', spacing3, spacing2)
> +    _c('%sxcb_generic_error_t%s **e)', spacing3, spacing2)
>      _c('{')
>  
>      if len(unserialize_fields)>0:
> @@ -2514,8 +2514,8 @@ def _c_reply_fds(self, name):
>      _c('')
>      _hc('int *')
>      _hc('%s (xcb_connection_t%s  *c  /**< */,', self.c_reply_fds_name, spacing1)
> -    _h('%s%s  *reply  /**< */);', spacing3, self.c_reply_type)
> -    _c('%s%s  *reply  /**< */)', spacing3, self.c_reply_type)
> +    _h('%s%s  *reply);', spacing3, self.c_reply_type)
> +    _c('%s%s  *reply)', spacing3, self.c_reply_type)
>      _c('{')
>  
>      _c('    return xcb_get_reply_fds(c, reply, sizeof(%s) + 4 * reply->length);', self.c_reply_type)
> @@ -2542,7 +2542,7 @@ def _c_cookie(self, name):
>      _h(' * @brief %s', self.c_cookie_type)
>      _h(' **/')
>      _h('typedef struct %s {', self.c_cookie_type)
> -    _h('    unsigned int sequence; /**<  */')
> +    _h('    unsigned int sequence;')
>      _h('} %s;', self.c_cookie_type)
>  
>  def _man_request(self, name, void, aux):



More information about the Xcb mailing list