compiler: use NDEBUG to guard asserts
authorEric Engestrom <eric.engestrom@imgtec.com>
Thu, 23 Nov 2017 13:16:43 +0000 (13:16 +0000)
committerEric Engestrom <eric.engestrom@imgtec.com>
Tue, 28 Nov 2017 10:54:38 +0000 (10:54 +0000)
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@imgtec.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/compiler/nir/nir.h
src/compiler/nir/nir_metadata.c
src/compiler/nir/nir_validate.c

index cf200fdc665dd15c0177336fc4bd0e09dab80aad..c01fa6707a4f88f99b51711385b16d953f8e21fd 100644 (file)
@@ -41,9 +41,9 @@
 #include "compiler/shader_info.h"
 #include <stdio.h>
 
-#ifdef DEBUG
+#ifndef NDEBUG
 #include "util/debug.h"
-#endif /* DEBUG */
+#endif /* NDEBUG */
 
 #include "nir_opcodes.h"
 
@@ -2336,7 +2336,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);
@@ -2377,7 +2377,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                                                           \
index f71cf432b703451e6997e896f8766baa03ebb84a..e681ba34f7557a7c30517f40ebd62d3b2bc15f6f 100644 (file)
@@ -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).
  *
index 9bf8c7029012ef26af146b56b1be41bc5fbc0805..a49948fbb489beb9509e4c39992a9f90eef25b06 100644 (file)
@@ -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.