Skip to content

util: Enable list_assert and simple_mtx_assert_locked in debugoptimized builds

Alyssa Rosenzweig requested to merge alyssa/mesa:ndebug into main

In debugoptimized builds, DEBUG is not set (and neither is NDEBUG). The intention of NDEBUG is to disable assertions. As such, list and mutex assertions should be gated on !NDEBUG as opposed to on DEBUG.

This would have caught an assertion failure (due to the wrong iterator used) sooner for the Valhall compiler. (Bug caught by @icecream95 )

Cc @dbaker @eric @anholt as the usual tools trio.


There's a strong case for deleting the DEBUG macro altogether and handling as NDEBUG. A debugoptimized build is expected to be optimized for debug 😉 I'm not sure there's a particularly strong case for wanting !NDEBUG but not DEBUG, unless someone can prove with significant perf numbers otherwise (i.e. that it would hobble developer's workflows, assuming debugoptimized is the standard Mesa developer build target for dogfooding.)

And if it's just a few cases where the debug noise is expensive, that should maybe be dealt with separately.

I rather expect this to trip over bugs in other drivers...

Merge request reports