[Xcb] [PATCH] c_client.py: Always initialize xcb_align_to

Daniel Martin consume.noise at gmail.com
Sun Aug 11 08:38:23 PDT 2013


On Sun, Aug 11, 2013 at 04:03:31PM +0200, Uli Schlachter wrote:
> On 09.01.2013 12:52, Daniel Martin wrote:
> > to get rid of:
> >     warning: 'xcb_align_to' may be used uninitialized in this function
> 
> Uhm. I don't get such a warning here. Could you add some information on where
> that warning comes from (source code location, compiler version) and perhaps
> also on why it happens? (=Why is this a correct fix instead of just hiding the
> problem?)

I've hit this warning while working on the XI stuff. At that time it
occured. Since then I've had that patch in my private branches. Now, I
just tried without and can't reproduce it again. And I've no clue which
compiler version was at that time in my ArchLinux.

I'll remove it.

> > Signed-off-by: Daniel Martin <consume.noise at gmail.com>
> > ---
> >  src/c_client.py | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/src/c_client.py b/src/c_client.py
> > index ec66223..fcc9cd1 100644
> > --- a/src/c_client.py
> > +++ b/src/c_client.py
> > @@ -1122,11 +1122,11 @@ def _c_serialize(context, self):
> >              _c('    %s *xcb_out = *_buffer;', self.c_type)
> >              _c('    unsigned int xcb_out_pad = -sizeof(%s) & 3;', self.c_type)
> >              _c('    unsigned int xcb_buffer_len = sizeof(%s) + xcb_out_pad;', self.c_type)
> > -            _c('    unsigned int xcb_align_to;')
> > +            _c('    unsigned int xcb_align_to = 0;')
> >          else:
> >              _c('    char *xcb_out = *_buffer;')
> >              _c('    unsigned int xcb_buffer_len = 0;')
> > -            _c('    unsigned int xcb_align_to;')
> > +            _c('    unsigned int xcb_align_to = 0;')
> >          prefix = [('_aux', '->', self)]
> >          aux_ptr = 'xcb_out'
> >  
> > @@ -1149,7 +1149,7 @@ def _c_serialize(context, self):
> >          _c('    unsigned int xcb_buffer_len = 0;')
> >          _c('    unsigned int xcb_block_len = 0;')
> >          _c('    unsigned int xcb_pad = 0;')
> > -        _c('    unsigned int xcb_align_to;')
> > +        _c('    unsigned int xcb_align_to = 0;')
> >  
> >      elif 'sizeof' == context:
> >          param_names = [p[2] for p in params]
> > @@ -1194,7 +1194,7 @@ def _c_serialize(context, self):
> >              _c('    unsigned int xcb_buffer_len = 0;')
> >              _c('    unsigned int xcb_block_len = 0;')
> >              _c('    unsigned int xcb_pad = 0;')        
> > -            _c('    unsigned int xcb_align_to;')
> > +            _c('    unsigned int xcb_align_to = 0;')
> >  
> >      _c('')
> >      for t in temp_vars:
> 
> 
> -- 
> Q: Because it reverses the logical flow of conversation.
> A: Why is putting a reply at the top of the message frowned upon?
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list