[Mesa-dev] [PATCH] list: add some iterator debug

Rob Clark robdclark at gmail.com
Tue May 28 13:55:29 UTC 2019


On Mon, May 27, 2019 at 5:06 AM Rob Clark <robdclark at gmail.com> wrote:
>
> On Mon, May 27, 2019 at 4:39 AM Erik Faye-Lund
> <erik.faye-lund at collabora.com> wrote:
> >
> > On Mon, 2019-05-27 at 13:37 +0200, Erik Faye-Lund wrote:
> > > On Mon, 2019-05-27 at 04:23 -0700, Rob Clark wrote:
> > > > On Mon, May 27, 2019 at 2:50 AM Erik Faye-Lund
> > > > <erik.faye-lund at collabora.com> wrote:
> > > > > On Sat, 2019-05-25 at 15:44 -0700, Rob Clark wrote:
> > > > > > This ends up embedded in a for loop expression, ie. the C part
> > > > > > in
> > > > > > an
> > > > > > for (A;B;C)
> > > > > >
> > > > > > iirc, that means it needs to be a C expr rather than
> > > > > > statement..
> > > > > > or
> > > > > > something roughly like that, I'm too lazy to dig out my C
> > > > > > grammar
> > > > > >
> > > > >
> > > > > Can't you just call a static helper function to do the
> > > > > validation?
> > > > > Function calls are valid expressions...
> > > >
> > > > I do like the fact that with the current patch I get the correct
> > > > line
> > > > # in the assert msg.. but perhaps #ifdef MSVC we can make it a
> > > > static
> > > > inline instead?  I'm not sure how many people do active feature dev
> > > > of
> > > > mesa on windows (as opposed to doing dev on linux and then
> > > > compiling/shipping non-debug builds on windows), so maybe just
> > > > disabling the list debug on MSVC is fine.
> > > >
> > > > BR,
> > > > -R
> >
> > I guess I should also have mentioned that I *do* sometimes do feature
> > development for Mesa on Windows, so I'd really like to get to benefit
> > from debug-helpers.
> >
>
> ok, that  was the answer I was looking for, whether it actually
> benefits anyone to re-invent assert
>

I've pushed a MR[1] with a slightly different solution, but I think
this should work for MSVC

-------
#ifdef DEBUG
#  define list_assert(cond, msg)  assert(cond && msg)
#else
#  define list_assert(cond, msg)  (void)(0 && (cond))
#endif
-------

[1] https://gitlab.freedesktop.org/mesa/mesa/merge_requests/962


More information about the mesa-dev mailing list