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>
This commit is contained in:
parent
2410993ef6
commit
fa67f119f2
|
@ -147,12 +147,10 @@ public:
|
|||
#define AS_BASE(TYPE) \
|
||||
class ir_##TYPE *as_##TYPE() \
|
||||
{ \
|
||||
assume(this != NULL); \
|
||||
return is_##TYPE() ? (ir_##TYPE *) this : NULL; \
|
||||
} \
|
||||
const class ir_##TYPE *as_##TYPE() const \
|
||||
{ \
|
||||
assume(this != NULL); \
|
||||
return is_##TYPE() ? (ir_##TYPE *) this : NULL; \
|
||||
}
|
||||
|
||||
|
@ -164,12 +162,10 @@ public:
|
|||
#define AS_CHILD(TYPE) \
|
||||
class ir_##TYPE * as_##TYPE() \
|
||||
{ \
|
||||
assume(this != NULL); \
|
||||
return ir_type == ir_type_##TYPE ? (ir_##TYPE *) this : NULL; \
|
||||
} \
|
||||
const class ir_##TYPE * as_##TYPE() const \
|
||||
{ \
|
||||
assume(this != NULL); \
|
||||
return ir_type == ir_type_##TYPE ? (const ir_##TYPE *) this : NULL; \
|
||||
}
|
||||
AS_CHILD(variable)
|
||||
|
|
Loading…
Reference in New Issue