glsl: Drop this != NULL assertions
authorJason Ekstrand <jason.ekstrand@collabora.com>
Tue, 17 May 2022 15:48:40 +0000 (10:48 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 18 May 2022 00:37:50 +0000 (00:37 +0000)
commitfa67f119f2b3d576a1dbeffdf7e510aea2caf848
tree775b1efa8f06ec11a108ba403ccbe66dbdadb042
parent2410993ef6054e452aff18109343cf8db5946e6c
glsl: Drop this != NULL assertions

If this == NULL, we'll get a crash which is pretty much the same thing
when it comes to ease of debugging.  This fixes a giant pile of warnings
with GCC 12 of the form:

    ../src/compiler/glsl/ir.h: In member function ‘ir_dereference* ir_instruction::as_dereference()’:
    ../src/util/macros.h:149:30: warning: ‘nonnull’ argument ‘this’ compared to NULL [-Wnonnull-compare]
      149 | #define assume(expr) ((expr) ? ((void) 0) \
          |                      ~~~~~~~~^~~~~~~~~~~~~~
      150 |                              : (assert(!"assumption failed"), \
          |                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      151 |                                 __builtin_unreachable()))
          |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
    ../src/compiler/glsl/ir.h:150:7: note: in expansion of macro ‘assume’
      150 |       assume(this != NULL);                             \
          |       ^~~~~~
    ../src/compiler/glsl/ir.h:160:4: note: in expansion of macro ‘AS_BASE’
      160 |    AS_BASE(dereference)

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16558>
src/compiler/glsl/ir.h