Get rid of debug_assert()
This has been bothering me for months. When we pulled various bits of gallium into the rest of Mesa, we've also pulled in u_debug.h
which has it's own assert macro. This has a couple of differences from the normal assert()
in assert.h
:
- It's defined as
(void)(0 && (expr))
in release builds so it requires its argument to be valid regardless of whether debug or release even though it's dead code. This means you get fewer "unused foo" messages but also means that code which defined certain things only in debug builds to avoid those messages in release sudeenly stops building. - It isn't defined to be
noreturn
soassert(!"str")
is no longer detected asnoreturn
by GCC. If you use anassert(!"str")
as an unreachable in, for instance, a switch statement, it may stop building the momentu_debug.h
is included. - It has a different stack depth than the classic
assert()
which means that when you hit an assert in GCC, you don't know how many frames you need to go up to get to the code. With the classicassert()
, it's 4. Withdebug_assert()
, it's 6.
Can we get rid of it? I don't see that it's gaining us any value and, while some of the above is nice or fine, I don't know that it's gaining us much.