[Mesa-dev] [PATCH v2 1/9] util: Add a virtual memory allocator

Jordan Justen jordan.l.justen at intel.com
Wed May 23 17:50:08 UTC 2018


On 2018-05-23 01:47:05, Eric Engestrom wrote:
> On Wednesday, 2018-05-23 00:25:11 -0700, Jordan Justen wrote:
> > On 2018-05-22 14:52:28, Scott D Phillips wrote:
> > > +
> > > +#ifndef NDEBUG
> > > +static void
> > > +util_vma_heap_validate(struct util_vma_heap *heap)
> > > +{
> > 
> > I'd rather have #ifndef NDEBUG for just the body of the function. I
> > feel confident the compiler in release mode can optimize out an empty
> > static function.
> 
> While at it, I'm pretty sure the compiler can also optimise out an empty
> loop, which is what this code compiles to with NDEBUG, so no guards
> necessary at all?

That was discussed in v1. Scott even verified that GCC and clang
optimized it away. I still think it is better to ifndef the code.

-Jordan


More information about the mesa-dev mailing list