[Mesa-dev] [PATCH] gallium: fix clang warnings

Jan Vesely jv356 at scarletmail.rutgers.edu
Wed Sep 7 12:40:38 UTC 2016


On Wed, 2016-09-07 at 10:12 +0200, Nicolai Hähnle wrote:
> On 07.09.2016 09:38, Michel Dänzer wrote:
> > 
> > On 07/09/16 12:29 AM, Nicolai Hähnle wrote:
> > > 
> > > On 06.09.2016 16:37, Martina Kollarova wrote:
> > > > 
> > > > 1. Variable 'hole' is uninitialized when used here [-
> > > > Wuninitialized]
> > > > 2. Comparison of constant -1 with expression of type 'unsigned
> > > > int' is
> > > > always
> > > >    false [-Wtautological-constant-out-of-range-compare]
> > > > ---
> > > >  src/gallium/winsys/radeon/drm/radeon_drm_bo.c     | 2 +-
> > > >  src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c | 5 -----
> > 
> > BTW, please split this up into one patch per component next time.
> > 
> > 
> > > 
> > > > 
> > > > diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> > > > b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> > > > index 56aab48..23ee8d5 100644
> > > > --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> > > > +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
> > > > @@ -200,7 +200,7 @@ static uint64_t radeon_bomgr_find_va(struct
> > > > radeon_drm_winsys *rws,
> > > >  static void radeon_bomgr_free_va(struct radeon_drm_winsys
> > > > *rws,
> > > >                                   uint64_t va, uint64_t size)
> > > >  {
> > > > -    struct radeon_bo_va_hole *hole;
> > > > +    struct radeon_bo_va_hole *hole = NULL;
> > > 
> > > This is a false positive, [...]
> > 
> > That's debatable, but anyway it's probably better addressed by
> > porting
> > https://cgit.freedesktop.org/mesa/drm/commit/?id=b214b05ccd433c484a
> > 6a65e491a1a51b19e4811d
> > to src/util/list.h .
> 
> You're right, that should fix it. Separately, it might be a good idea
> to 
> move the declaration of hole down into the scopes where it's actually
> used.

Hi, is there a reason not to use 'offsetof' from stddef.h instead of
pointer arithmetics? it's C standard, so it should be cross platform
enough.

Jan

> 
> Nicolai
> 
> > 
> > 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160907/894fb37c/attachment.sig>


More information about the mesa-dev mailing list