[Mesa-dev] [PATCH mesa] u_debug: do not compile asserts when they are disabled

Michel Dänzer michel at daenzer.net
Fri Dec 1 10:03:20 UTC 2017

On 2017-11-30 01:16 PM, Eric Engestrom wrote:
> Commit f0ba7d897d1c22202531a added this code to expose asserts to the
> compiler in an attempt to hide 'unused variable' warnings, incorrectly
> claiming it was a no-op. This has two bad effects:
> - any assert with side-effects are executed when they should be
>   disabled

The "0 &&" should prevent this.

> - the whole content of the assert must be understandable by the
>   compiler, which isn't true if variable or members are correctly
>   guarded by NDEBUG

Yes, not having to guard things by NDEBUG was a major point of doing it
this way. :)

Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

More information about the mesa-dev mailing list