Re: [igt-dev] [Intel-gfx] [PATCH i-g-t] lib: Silence Valgrind warning in synce_fence_status

Chris Wilson
2019-06-27T14:01:35Z

Quoting Jani Nikula (2019-06-27 14:59:52)
> On Thu, 27 Jun 2019, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> > From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >
> > Let Valgrind know the ioctl initializes the passed in info block to reduce
> > the noise while debugging.
> >
> > Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> > lib/sw_sync.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/lib/sw_sync.c b/lib/sw_sync.c
> > index f208603312c2..73f3f7015d9d 100644
> > --- a/lib/sw_sync.c
> > +++ b/lib/sw_sync.c
> > @@ -41,6 +41,15 @@
> > #include "drmtest.h"
> > #include "ioctl_wrappers.h"
> >
> > +#ifdef HAVE_VALGRIND
> > +#include <valgrind/valgrind.h>
> > +#include <valgrind/memcheck.h>
> > +
> > +#define VG(x) x
> > +#else
> > +#define VG(x) do {} while (0)
>
> OOC, why not just
>
> #define VALGRIND_MAKE_MEM_DEFINED(...)

Once upon a time, in a project far far away, VG() was used to
conditionally compile code for extra debug under valgrind and so the
pattern took root.
-Chris