nir/validate: refactor validate_assert to have a return value

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11775>
This commit is contained in:
Mike Blumenkrantz 2021-05-07 14:06:23 -04:00 committed by Marge Bot
parent e212a191a6
commit 499cc7a9ec
1 changed files with 12 additions and 4 deletions

View File

@ -120,10 +120,18 @@ log_error(validate_state *state, const char *cond, const char *file, int line)
_mesa_hash_table_insert(state->errors, obj, msg);
}
#define validate_assert(state, cond) do { \
if (!(cond)) \
log_error(state, #cond, __FILE__, __LINE__); \
} while (0)
static bool
validate_assert_impl(validate_state *state, bool cond, const char *str,
const char *file, unsigned line)
{
if (!cond)
log_error(state, str, file, line);
return cond;
}
#define validate_assert(state, cond) \
validate_assert_impl(state, (cond), #cond, __FILE__, __LINE__)
static void validate_src(nir_src *src, validate_state *state,
unsigned bit_sizes, unsigned num_components);