[Mesa-dev] [PATCH mesa] compiler: use proper guard for asserts
Eric Engestrom
eric.engestrom at imgtec.com
Fri Nov 24 13:12:04 UTC 2017
I ended up looking at all the uses of DEBUG in Mesa, and will send
a whole series next week, including more changes in nir & compiler,
so you can disregard this patch for now.
On Thursday, 2017-11-23 13:24:25 +0000, Eric Engestrom wrote:
> nir_validate.c's #endif already had the correct NDEBUG comment
>
> Fixes: dcb1acdea00a8f2c29777 "nir/validate: Only build in debug mode"
> Fixes: 9ff71b649b4b3808a9e17 "i965/nir: Validate that NIR passes call nir_metadata_preserve()"
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
> src/compiler/nir/nir.h | 4 ++--
> src/compiler/nir/nir_metadata.c | 2 +-
> src/compiler/nir/nir_validate.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index f46f6147110acbffec5c..626f5f5a5533e577c66b 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -2325,7 +2325,7 @@ nir_deref_var *nir_deref_var_clone(const nir_deref_var *deref, void *mem_ctx);
>
> nir_shader *nir_shader_serialize_deserialize(void *mem_ctx, nir_shader *s);
>
> -#ifdef DEBUG
> +#ifndef NDEBUG
> void nir_validate_shader(nir_shader *shader);
> void nir_metadata_set_validation_flag(nir_shader *shader);
> void nir_metadata_check_validation_flag(nir_shader *shader);
> @@ -2366,7 +2366,7 @@ static inline void nir_metadata_check_validation_flag(nir_shader *shader) { (voi
> static inline bool should_clone_nir(void) { return false; }
> static inline bool should_serialize_deserialize_nir(void) { return false; }
> static inline bool should_print_nir(void) { return false; }
> -#endif /* DEBUG */
> +#endif /* NDEBUG */
>
> #define _PASS(nir, do_pass) do { \
> do_pass \
> diff --git a/src/compiler/nir/nir_metadata.c b/src/compiler/nir/nir_metadata.c
> index f71cf432b703451e6997..e681ba34f7557a7c3051 100644
> --- a/src/compiler/nir/nir_metadata.c
> +++ b/src/compiler/nir/nir_metadata.c
> @@ -59,7 +59,7 @@ nir_metadata_preserve(nir_function_impl *impl, nir_metadata preserved)
> impl->valid_metadata &= preserved;
> }
>
> -#ifdef DEBUG
> +#ifndef NDEBUG
> /**
> * Make sure passes properly invalidate metadata (part 1).
> *
> diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c
> index 9bf8c7029012ef26af14..a49948fbb489beb9509e 100644
> --- a/src/compiler/nir/nir_validate.c
> +++ b/src/compiler/nir/nir_validate.c
> @@ -35,7 +35,7 @@
> /* Since this file is just a pile of asserts, don't bother compiling it if
> * we're not building a debug build.
> */
> -#ifdef DEBUG
> +#ifndef NDEBUG
>
> /*
> * Per-register validation state.
> --
> Cheers,
> Eric
>
More information about the mesa-dev
mailing list