Quoting Kenneth Graunke (2017-09-20 13:42:45)
> On Wednesday, September 20, 2017 1:27:39 PM PDT Dylan Baker wrote:
> > It is possible to have DEBUG disabled but asserts on, which cannot build
> > because these asserts work on members that are only present when DEBUG
> > is on.
> > 
> > Signed-off-by: Dylan Baker <dylanx.c.ba...@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;
> >  }
> >  
> > 
> 
> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org>
> 
> It might make senes to change all of these #ifdef DEBUG to #ifndef NDEBUG
> which is the actual condition for assert not getting compiled away.
> 
> DEBUG is some Mesa thing, I think.

Yeah, DEBUG is a mesa thing.

I think it's a little strange to have both, but it doesn't really matter to me
either way.

Dylan

Attachment: signature.asc
Description: signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to