[Mesa-dev] [PATCH v4 2/4] util/ralloc: Don't define assert with magic member without DEBUG

Dylan Baker dylan at pnwbakers.com
Wed Sep 27 16:02:18 UTC 2017


Quoting Eric Engestrom (2017-09-27 04:10:37)
> On Tuesday, 2017-09-26 23:38:11 +0000, Dylan Baker wrote:
> > It is possible to have DEBUG disabled but asserts on (NDEBUG(, which
> 
> parentheses typo
> 
> other than that:
> Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>
> 
> and I think you should've pushed these first two patches instead of
> carrying them in your unrelated meson series :)
> 
> speaking of, I'm happy to write the egl/meson.build; I'll get on that
> when the initial support lands.

I do have most of the classic dri stack building in a branch on top of this
work, I'm working on getting GLX, EGL, etc building at the moment. I'll send
that out as a "WIP" series after this lands so that others can look at it and we
don't all end up duplicating effort.

Dylan

> 
> > cannot build because these asserts work on members that are only present
> > when DEBUG is on.
> > 
> > Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
> > Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> > ---
> >  src/util/ralloc.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/src/util/ralloc.c b/src/util/ralloc.c
> > index 566f08ad94e..9cce9e02f68 100644
> > --- a/src/util/ralloc.c
> > +++ b/src/util/ralloc.c
> > @@ -630,7 +630,9 @@ linear_alloc_child(void *parent, unsigned size)
> >     linear_size_chunk *ptr;
> >     unsigned full_size;
> >  
> > +#ifdef DEBUG
> >     assert(first->magic == LMAGIC);
> > +#endif
> >     assert(!latest->next);
> >  
> >     size = ALIGN_POT(size, SUBALLOC_ALIGNMENT);
> > @@ -702,7 +704,9 @@ linear_free_parent(void *ptr)
> >        return;
> >  
> >     node = LINEAR_PARENT_TO_HEADER(ptr);
> > +#ifdef DEBUG
> >     assert(node->magic == LMAGIC);
> > +#endif
> >  
> >     while (node) {
> >        void *ptr = node;
> > @@ -721,7 +725,9 @@ ralloc_steal_linear_parent(void *new_ralloc_ctx, void *ptr)
> >        return;
> >  
> >     node = LINEAR_PARENT_TO_HEADER(ptr);
> > +#ifdef DEBUG
> >     assert(node->magic == LMAGIC);
> > +#endif
> >  
> >     while (node) {
> >        ralloc_steal(new_ralloc_ctx, node);
> > @@ -734,7 +740,9 @@ void *
> >  ralloc_parent_of_linear_parent(void *ptr)
> >  {
> >     linear_header *node = LINEAR_PARENT_TO_HEADER(ptr);
> > +#ifdef DEBUG
> >     assert(node->magic == LMAGIC);
> > +#endif
> >     return node->ralloc_parent;
> >  }
> >  
> > -- 
> > 2.14.1
> > 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170927/43392038/attachment-0001.sig>


More information about the mesa-dev mailing list